NumericFormat Property

Gets or sets the numeric display format string.

object.NumericFormat = [string]

Where object is an object expression that evaluates to one of the controls in the Applies To list, and string is a string expression specifying the numeric format used to display the contents of the control.

Client support

   Newlook Smartclient

   Newlook Server

Use

This property is used to specify how the contents of a numeric control will be displayed in the GUI. Setting the NumericFormat property will not change the underlying value of the control.

TIP!

If a control has a numeric format specified and there is also a format specified for the form then the format specified within the control will take precedence.

Settings

The following table shows the special characters that may be used within the DisplayFormat expression.

A format expression may have one, two, three or four sections, each delimited by a semi-colon (;) character. The following explains how the use of each section works:

Formatting Character

Description

Empty string

Displays the number without any formatting.

0

Digit placeholder.
Used to display leading or trailing zeroes if the number has fewer digits than there are zeroes (to either the left or right of the decimal point). If there are more digits in the number to the left of the decimal point (i.e. integer digits) than there are zeroes in the format string, then these digits will be displayed (i.e. the integer portion will never be truncated). If there are more digits to the right of the decimal point, then the number will be rounded to the nearest place as indicated by the number of zeroes to the right of the decimal place within the format string.

#

Digit placeholder.
Follows the same rules as the 0 character, except that leading or trailing zeroes are not displayed. Note that the resulting string is only large enough to hold the final string and is not padded with spaces for where unused # digits are specified.

.

Decimalplaceholder.
Determines the position of the decimal place. Specifying more than one decimal placeholder within the format string will cause the result to be Error. If the format string does not contain any decimal placeholder, any fractional portion of the number will be rounded and the result will contain only integer digits. The actual character used to represent the decimal point in the resulting expression depends on the setting defined within the International section of the Win.ini file (can be modified from the Windows Control Panel). Some countries use a comma as the decimal separator.

,

Thousandseparator.
Used to separate thousands for numbers that have 4 or more digits to the left of the decimal point. If the thousands separator is used within # digit placeholders and there are not enough digits in the number to fill them, then the thousands separator does not display either. A thousand separator specified anywhere other than to the left of the decimal placeholder is treated as a literal character and also inserted. The actual character used to represent the thousands separator depends on the setting defined within the International section of the Win.ini file (can be modified from the Windows Control Panel). Some countries use a period as the thousands separator.

%

Percentageplaceholder.
Determines the position of the percent sign. The number is multiplied by 100. Specifying more than one percentage placeholder within the format string will cause the result to be Error.

E- E+ e- e+

Scientificnotation.
If these characters are used, Newlook reformats the number in scientific format and inserts an E or e in between the number and its exponent. The number of digits to the right determines the number of digits to be displayed within the exponent. Use E- or e- to precede the exponent with a minus sign if the exponent is negative. E+ or e+ works the same, except that it will insert a plus sign if the exponent is positive or zero.

\

Literalcharacters.
Characters proceeded with the backslash (\) character are treated as literal characters which are inserted without interpretation. E.g. You could insert a fixed literal character 0 which will not be used as a digit placeholder by using the \0 character sequence.

“ABC”

Stringliterals.
To guarantee an entire string is included without formatting interpretation, you can enclose it within the double quote character. To insert the double quote character into a string use the Chr(34) function (34 is the ANSI code for the double quote character).

Any others

All other characters (not listed above) are simply inserted one-for-one as literal characters into the final resulting string.

 

Examples

DisplayFormat String

Value

Displayed Text

Empty String ("")

2

2

Empty String ("")

-2

-2

Empty String ("")

.2

.2

0

2

2

0

-2

-2

0

.2

0

0.00

2

2.00

0.00

-2

-2.00

0.00

.2379

0.24

#,##0

2,000

2,000

#,##0

-2,000

-2,000

#,##0

.2379

0

AU$#,##0.00;(AU$#,##0.00)

2

AU$2.00

AU$#,##0.00;(AU$#,##0.00)

-2

(AU$2.00)

AU$#,##0.00;(AU$#,##0.00)

0.2379

AU$0.24

00.00.00

23

(Error)

0%

2

200%

0%

-2

-200%

0%

0.2379

24%

##%0%

.235

(Error)

0.00E+00

2

2.00E+00

0.00E+00

-2

-2.00E+00

0.00E+00

0.2379

2.37E-01

0.00E-00

2

2.00E00

0.00E-00

-2

-2.00E00

0.00E-00

0.2379

2.37E-01

\#000

2

#003

"#E"000

2

#E002

00;(00);nil;unknown

0

nil

00;(00);nil;unknown

 

unknown

Min 000mm

23

Min 023mm

See Also

DecimalSymbol property | DigitGroupingSymbol property | DateFormat property

Applies To

NumericCombo control, Form object