An object for formatting numbers in a currency format.
CurrencyFormat is a coclass that formats numbers to look like a currency. For example, the number 123456.789 when formatted with CurrencyFormat (default U.S. English regional settings) would look like $123,456.79. Note that the formatted number is rounded to the nearest cent. Negative numbers are typically depicted inside parenthesis, e.g., a negative number of the same value would be formatted as ($123,456.79).
To format numbers as currency, create a CurrencyFormat object and use the ValueToString method.
| Interfaces | Description |
|---|---|
| IClone | Provides access to members that control cloning of objects. |
| INumberFormat | Provides access to members that format numbers. |
| INumberFormatOperations | Provides access to common operations on formatted numbers. |
| IPersist | |
| IPersistStream |
CurrencyFormat does not have an ICurrencyFormat interface because there are no member properties to set. To use it, define an object as an INumberFormat and set it to a New CurrencyFormat. You can access the ValueToString and StringToValue methods directly from this object.
Numbers are formatted using the current regional settings defined for the system at runtime. To change the way currency numbers are formatted, change the settings on the Currency tab of Control Panel's Regional Settings applet.
To try out various formatting options using this coclass, select CurrencyFormat from the dropdown list in the NumberFormat Viewer developer sample.
ILatLonFormat2 Interface | ICustomNumberFormat Interface | RateFormat CoClass | INumberFormat Interface | IRateFormat Interface | IAngleFormat Interface | INumericFormat Interface | ILatLonFormat Interface | CustomNumberFormat CoClass | PercentageFormat CoClass | NumericFormat CoClass | IFractionFormat Interface | IScientificNumberFormat Interface | ScientificFormat CoClass | FractionFormat CoClass | IPercentageFormat Interface | CurrencyFormat CoClass | LatLonFormat CoClass | AngleFormat CoClass