ComponentOne True DBInput Pro 8.0
Format Property (TDBNumber)

 

Format Property (TDBNumber)

Sets/returns the input format to use in the control.

Syntax

TDBNumber.Format= string

Read/Write at run time and design time.

Values

The following are the keywords available in the Format property (####0;;;Null is the default):

#

Defines an optional numeric character.

0

Defines a required numeric character.

.

A period that defines the location of the decimal point.

,

A comma that defines the location of the separator.

;

Delimiter between different format patterns.

{}

Specify a zero-length string or SBCS character between the braces which fills the character in all the digits of the display mask for the Zero and the Null format patterns.

Remarks

The format is specified by creating a mask using keywords and literals. The literals cannot be specified between the keywords. They must be set on both ends of the mask such as "Plus ###.## $". Note that the input mask must not exist only with literals. When keywords need to be used as literals, place a backslash before the keyword. This will differentiate a keyword from a literal.

The number of digits set in this property must not exceed the maximum fifteen digits.

The format string is made up of four separate format patterns, delimited with a semicolon (";").  The first pattern is used for positive values, the second for negative values, the third for zero values and the fourth for Null values.

See the DisplayFormat property for a lengthy discussion of these four patterns.

To determine whether the underlying value can be set to zero or Null, can be set using the ClearAction property. The Format and the DisplayFormat properties will not affect the underlying value when the number of the digits specified in the formats differ from each other

If set a value to the Value property which the number of decimal digits exceed the number specified in the input format, the exceeding digits will be automatically rounded down. For example when setting a value "123456.1567" with the input format is set to "######.##", the 3rd decimal place will be rounded down, displaying "123456.15". However, in the case of the integer digits, it will be handled as an invalid value.

If a floating-point value is read from a database or set at run time and it contains more decimal digits than can be displayed, the control will maintain the precise value. However, only the number of digits specified with the input mask will be displayed in the control. If the integral digits exceed the specified number of digits, the value will be handled as an invalid value.

Resetting the input format will cause the underlying value to set to Null. The user would need to initialize the value after changing the Format property.

When the DisplayFormat property is set to a zero-length string, the format set in the Format property will be applied for both when inputting and displaying.

The character specified between the braces ("{}") in the input mask must be set to a zero-length string or a SBCS character. A DBCS character will be treated as an error.

See Also

Value Property (TDBNumber)

Text Property (TDBNumber)

DisplayFormat Property (TDBNumber)

ClearAction Property (TDBNumber)

NegativeColor Property (TDBNumber)

ClearControl Method (TDBNumber)

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback