Partager via


COleCurrency::Format

Call this member function to create a formatted representation of the currency value.

CString Format( 
   DWORD dwFlags = 0, 
   LCID lcid = LANG_USER_DEFAULT  
) const;

Parameters

  • dwFlags
    Indicates flags for locale settings. Only the following flag is relevant to currency:

    • LOCALE_NOUSEROVERRIDE   Use the system default locale settings, rather than custom user settings.
  • lcid
    Indicates locale ID to use for the conversion.

Return Value

A CString that contains the formatted currency value.

Remarks

It formats the value using the local language specifications (locale IDs). A currency symbol is not included in the value returned. If the status of this COleCurrency object is null, the return value is an empty string. If the status is invalid, the return string is specified by the string resource IDS_INVALID_CURRENCY.

Example

COleCurrency curA;           // value: 0.0000
curA.SetCurrency(4, 500);    // value: 4.0500 

// value returned: 4.05
curA.Format(0, MAKELCID(MAKELANGID(LANG_CHINESE,
   SUBLANG_CHINESE_SINGAPORE), SORT_DEFAULT));
// value returned: 4,05
curA.Format(0, MAKELCID(MAKELANGID(LANG_GERMAN,
   SUBLANG_GERMAN_AUSTRIAN), SORT_DEFAULT));

Requirements

Header: afxdisp.h

See Also

Reference

COleCurrency Class

Hierarchy Chart

COleCurrency::ParseCurrency

COleCurrency::GetStatus