SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftPrintPreview/DLL 2.0 - Print Preview Control (discontinued)
SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftDirectory 3.5 - File/Folder Control (discontinued)
SftMask/OCX 7.0 - Masked Edit Control
SftOptions 1.0 - Registry/INI Control (discontinued)
SftPrintPreview/OCX 1.0 - Print Preview Control (discontinued)
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftTabs/NET 6.0 - Tab Control (discontinued)
SftTree/NET 2.0 - Tree Control
Converts a value into a displayable currency string.
VB.NET | object.FormatCurrency(ByVal Val As Double, ByVal FracDigits As Short, ByVal LeadZero As Short, ByVal Grouping As Short, ByVal DecimalSep As String, ByVal ThousandSep As String, ByVal NegativeOrder As Short, ByVal PositiveOrder As Short, ByVal CurrencySymbol As String, ByRef Text As String) |
VB | object.FormatCurrency(ByVal Val As Double, ByVal FracDigits As Integer, ByVal LeadZero As Integer, ByVal Grouping As Integer, ByVal DecimalSep As String, ByVal ThousandSep As String, ByVal NegativeOrder As Integer, ByVal PositiveOrder As Integer, ByVal CurrencySymbol As String, Text As String) |
C#.NET | void object.FormatCurrency(double Val, short FracDigits, short LeadZero, short Grouping, string DecimalSep, string ThousandSep, short NegativeOrder, short PositiveOrder, string CurrencySymbol, out string Text); |
VC++ | HRESULT object->FormatCurrency(double Val, short FracDigits, short LeadZero, short Grouping, _bstr_t DecimalSep, _bstr_t ThousandSep, short NegativeOrder, short PositiveOrder, _bstr_t CurrencySymbol, _bstr_t* Text); |
C | HRESULT object->raw_FormatCurrency(double Val, short FracDigits, short LeadZero, short Grouping, BSTR DecimalSep, BSTR ThousandSep, short NegativeOrder, short PositiveOrder, BSTR CurrencySymbol, BSTR* Text); |
object
Val
A Double. This value is formatted as a string using the provided attributes and returned in Text.
FracDigits
The number of desired fractional digits (0-99) or -1. If -1 is specified, the user locale is used (see GetLocaleInfo, LOCALE_ICURRDIGITS).
LeadZero
1 if leading zeros are desired, otherwise 0. If -1 is specified, the user locale is used (see GetLocaleInfo, LOCALE_ILZERO).
Grouping
Specifies the size of each group of digits to the left of the decimal point (0-9). If -1 is specified, the user locale is used (see GetLocaleInfo, LOCALE_SMONGROUPING).
DecimalSep
The decimal separator string (up to four characters). If an empty string is specified, the user locale is used (see GetLocaleInfo, LOCALE_SMONDECIMALSEP).
ThousandSep
The thousands (group) separator string (up to five characters). If an empty string is specified, the user locale is used (see GetLocaleInfo, LOCALE_SMONTHOUSANDSEP).
NegativeOrder
The display mode for negative values (0-15). If -1 is specified, the user locale is used (see GetLocaleInfo, LOCALE_INEGCURR).
NegativeOrder | Example | Description |
---|---|---|
-1 | The user locale is used (see GetLocaleInfo, LOCALE_INEGCURR) | |
0 | ($1.1) | Left parenthesis, monetary symbol, number, right parenthesis |
1 | -$1.1 | Negative sign, monetary symbol, number |
2 | $-1.1 | Monetary symbol, negative sign, number |
3 | $1.1- | Monetary symbol, number, negative sign |
4 | (1.1$) | Left parenthesis, number, monetary symbol, right parenthesis |
5 | -1.1$ | Negative sign, number, monetary symbol |
6 | 1.1-$ | Number, negative sign, monetary symbol |
7 | 1.1$- | Number, monetary symbol, negative sign |
8 | -1.1 $ | Negative sign, number, space, monetary symbol (like 5, but with a space before the monetary symbol) |
9 | -$ 1.1 | Negative sign, monetary symbol, space, number (like 1, but with a space after the monetary symbol) |
10 | 1.1 $- | Number, space, monetary symbol, negative sign (like 7, but with a space before the monetary symbol) |
11 | $ 1.1- | Monetary symbol, space, number, negative sign (like 3, but with a space after the monetary symbol) |
12 | $ -1.1 | Monetary symbol, space, negative sign, number (like 2, but with a space after the monetary symbol) |
13 | 1.1- $ | Number, negative sign, space, monetary symbol (like 6, but with a space before the monetary symbol) |
14 | ($ 1.1) | Left parenthesis, monetary symbol, space, number, right parenthesis (like 0, but with a space after the monetary symbol) |
15 | (1.1 $) | Left parenthesis, number, space, monetary symbol, right parenthesis (like 4, but with a space before the monetary symbol) |
PositiveOrder
The display mode for positive values (0-3). If -1 is specified, the user locale is used (see GetLocaleInfo, LOCALE_ICURRENCY).
PositiveOrder | Example | Description |
---|---|---|
-1 | The user locale is used (see GetLocaleInfo, LOCALE_ICURRENCY) | |
0 | $1.1 | Prefix, no separation |
1 | 1.1$ | Suffix, no separation |
2 | $ 1.1 | Prefix, 1-character separation |
3 | 1.1 $ | Suffix, 1-character separation |
CurrencySymbol
The currency symbol string (up to six characters). If an empty string is specified, the user locale is used (see GetLocaleInfo, LOCALE_SMONDECIMALSEP). If the string "none" is specified, no currency string is used.
Text
The formatted string is returned in the Text argument.
The FormatCurrency method converts a value into a displayable currency string.
Calculator.FormatNumber is used to format numbers without currency attributes.
Calculator.FormatCurrencyV is used for languages such as VBScript, which are limited by requiring Variant arguments and do not support strongly typed arguments for return values. For more information please see Using SftMask/OCX with Internet Explorer.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim FmtVal As String AxSftMask1.Calculator.FormatCurrency(48533.85, -1, -1, -1, "", "", -1, -1, "", FmtVal) MsgBox(FmtVal) Dim Text As String Text = "short" AxSftMask1.Calendar.FormatDate(#8/1/2000#, Text) MsgBox(Text) Text = "long" AxSftMask1.Calendar.FormatDate(#8/1/2000#, Text) MsgBox(Text) Text = "dddd, MMMM d 'in the year' yyyy" AxSftMask1.Calendar.FormatDate(#8/1/2000#, Text) MsgBox(Text)
Private Sub Form_Load() Dim FmtVal As String SftMask1.Calculator.FormatCurrency 48533.85, -1, -1, -1, "", "", -1, -1, "", FmtVal MsgBox (FmtVal) Dim Text As String Text = "short" SftMask1.Calendar.FormatDate #8/1/2000#, Text MsgBox (Text) Text = "long" SftMask1.Calendar.FormatDate #8/1/2000#, Text MsgBox (Text) Text = "dddd, MMMM d 'in the year' yyyy" SftMask1.Calendar.FormatDate #8/1/2000#, Text MsgBox (Text)
private void Form1_Load(object sender, System.EventArgs e) { string FmtVal; axSftMask1.Calculator.FormatCurrency(48533.85, -1, -1, -1, "", "", -1, -1, "", out FmtVal); MessageBox.Show(FmtVal); string Text; Text = "short"; axSftMask1.Calendar.FormatDate(new DateTime(2000, 8, 1), ref Text); MessageBox.Show(Text); Text = "long"; axSftMask1.Calendar.FormatDate(new DateTime(2000, 8, 1), ref Text); MessageBox.Show(Text); Text = "dddd, MMMM d 'in the year' yyyy"; axSftMask1.Calendar.FormatDate(new DateTime(2000, 8, 1), ref Text); MessageBox.Show(Text);
BOOL CProject1Dlg::OnInitDialog() { CDialog::OnInitDialog(); m_pMask1 = m_Mask1.GetControlUnknown(); _ASSERT(m_pMask1 != NULL); CComBSTR FmtVal; m_pMask1->Calculator->FormatCurrency(48533.85, -1, -1, -1, _bstr_t(_T("")), _bstr_t(_T("")), -1, -1, _bstr_t(_T("")), &FmtVal); AfxMessageBox(CString(FmtVal)); FmtVal = _T("short"); m_pMask1->Calendar->FormatDate(COleDateTime(2000, 8, 1, 0,0,0), &FmtVal); AfxMessageBox(CString(FmtVal)); FmtVal = _T("long");
See Also SftMaskCalculator Object | Object Hierarchy