Visual Basic Language Reference  

Predefined Numeric Formats (Format Function)

The following table identifies the predefined numeric format names. These may be used by name as the style argument for the Format function:

Format name Description
General Number, G, or g Displays number with no thousand separator.
Currency, C, or c Displays number with thousand separator, if appropriate; display two digits to the right of the decimal separator. Output is based on system locale settings.
Fixed, F, or f Displays at least one digit to the left and two digits to the right of the decimal separator.
Standard, N, or n Displays number with thousand separator, at least one digit to the left and two digits to the right of the decimal separator.
Percent, P, or p Displays number multiplied by 100 with a percent sign (%) appended to the right; always display two digits to the right of the decimal separator.
Scientific, E, or e Uses standard scientific notation.
D, or d Displays number as a string that contains the value of the number in Decimal (base 10) format. This option is supported for integral types (Byte, Short, Integer, Long) only.
X, or x Displays number as a string that contains the value of the number in Hexadecimal (base 16) format. This option is supported for integral types (Byte, Short, Integer, Long) only.
Yes/No Displays No if number is 0; otherwise, displays Yes.
True/False Displays False if number is 0; otherwise, displays True.
On/Off Displays Off if number is 0; otherwise, displays On.

See Also

Format Function | Predefined Date/Time Formats (Format Function) | User-Defined Numeric Formats (Format Function)