Strings.FormatNumber Method
Assembly: Microsoft.VisualBasic (in microsoft.visualbasic.dll)
public static string FormatNumber ( Object Expression, [OptionalAttribute] int NumDigitsAfterDecimal, [OptionalAttribute] TriState IncludeLeadingDigit, [OptionalAttribute] TriState UseParensForNegativeNumbers, [OptionalAttribute] TriState GroupDigits )
public static String FormatNumber ( Object Expression, /** @attribute OptionalAttribute() */ int NumDigitsAfterDecimal, /** @attribute OptionalAttribute() */ TriState IncludeLeadingDigit, /** @attribute OptionalAttribute() */ TriState UseParensForNegativeNumbers, /** @attribute OptionalAttribute() */ TriState GroupDigits )
public static function FormatNumber ( Expression : Object, NumDigitsAfterDecimal : int, IncludeLeadingDigit : TriState, UseParensForNegativeNumbers : TriState, GroupDigits : TriState ) : String
Parameters
- Expression
Required. Expression to be formatted.
- NumDigitsAfterDecimal
Optional. Numeric value indicating how many places are displayed to the right of the decimal. The default value is –1, which indicates that the computer's regional settings are used.
- IncludeLeadingDigit
Optional. TriState constant that indicates whether a leading 0 is displayed for fractional values. See "Settings" for values.
- UseParensForNegativeNumbers
Optional. TriState constant that indicates whether to place negative values within parentheses. See "Settings" for values.
- GroupDigits
Optional. TriState constant that indicates whether or not numbers are grouped using the group delimiter specified in the locale settings. See "Settings" for values.
Return Value
Returns an expression formatted as a number.For more detailed information, see the Visual Basic topic FormatNumber Function (Visual Basic).
When one or more optional arguments are omitted the values for omitted arguments are provided by the locale settings.
Note |
|---|
| All settings information comes from the locale of the application. By default, that will be the locale set in the control panel. However, it may be changed programmatically by using the .NET Framework. |
The IncludeLeadingDigit, UseParensForNegativeNumbers, and GroupDigits arguments have the following settings.
| Constant | Description |
|---|---|
| TriState.True | True |
| TriState.False | False |
| TriState.UseDefault | The computer's regional settings |
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Note