INumberFormat Interface

Provides access to members that format numbers.

Description

The INumberFormatinterface exposes the two number formatting methods used by several interfaces and coclass objects. The ValueToStringmethod formats numerical values in a variety of formats depending on the interface used and its property settings. The StringToValuemethod returns values from formatted strings.

When To Use

Use the ValueToStringmethod to format numbers with any of the objects listed under CoClassesbelow. Use the StringToValuemethod to convert formatted strings to numeric values.

Members

Name Description
Method StringToValue Converts a formatted string to a numeric value.
Method ValueToString Converts a numeric value to a formatted string.

INumberFormat.StringToValue Method

Converts a formatted string to a numeric value.

Public Function StringToValue ( _
    ByVal str As String _
) As Double
public double StringToValue (
    string str
);

Description

The StringToValuemethod obtains a numerical value from a formatted string. The string doesn't necessarily need to have been formatted with the ValueToString**method, but the string needs to look like it would be if it was formatted with the associated interface's implementation of the ValueToString method. See the particular number formatting interface you're interested in under See Also**above for more information.

Remarks

When using the StringToValuemethod to obtain a ValueToStringargument value, the properties in the associated interface must be set the same as they were when the ValueToStringmethod was used. This applies in cases where ValueToStringmay perform a numerical conversion (in the IAngleFormat, IFractionFormat, IPercentageFormat, and IRateFormat****interfaces).

INumberFormat.ValueToString Method

Converts a numeric value to a formatted string.

Public Function ValueToString ( _
    ByVal Value As Double _
) As String
public string ValueToString (
    double Value
);

Description

The ValueToStringmethod expresses a numeric value as a formatted string. The string is formatted based on the property settings of the number formatting interface that is used. See the particular number formatting interface you're interested in under See Alsoabove for more information.

Classes that implement INumberFormat

Classes Description
AngleFormat An object for formatting numbers in an angle format.
CurrencyFormat An object for formatting numbers in a currency format.
CustomNumberFormat An object for formatting numbers in a user-defined format.
DateFormat An object for formatting date time.
DirectionFormat An object for formatting numbers in a direction format.
FractionFormat An object for formatting numbers in a fraction format.
LatLonFormat An object for formatting numbers in a lat/lon format.
NumericFormat An object for formatting numbers in a variety of numeric formats.
PercentageFormat An object for formatting numbers in a percentage format.
RateFormat An object for formatting numbers in a rate format.
ScientificFormat An object for formatting numbers in a scientific format.

Remarks

In some cases, the format produced by the ValueToStringmethod depends on _two_interface's property settings. These are the coclass objects that inherit the INumericFormat**interface in addition to their own default interface. These objects are the AngleFormat, LatLonFormat, PercentageFormat, and RateFormat**.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.