vb6parse 1.0.0

vb6parse is a library for parsing and analyzing VB6 code, from projects, to controls, to modules, and forms.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="VB6Parse Library Reference - formatcurrency - String">
    <title>formatcurrency - String - VB6Parse Library Reference</title>
    <link rel="stylesheet" href="../../../assets/css/style.css">
    <link rel="stylesheet" href="../../../assets/css/docs-style.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css">
    <script src="../../../assets/js/theme-switcher.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/vbnet.min.js"></script>
    <script>hljs.highlightAll();</script>
</head>
<body>
    <header class="docs-header">
        <div class="container">
            <h1><a href="../../../index.html">VB6Parse</a> / <a href="../../../library/index.html">Library</a> / <a href="../../../library/functions/string/index.html">String</a> / formatcurrency</h1>
            <p class="tagline">VB6 Library Reference</p>
        </div>
    </header>

    <nav class="docs-nav">
        <div class="container">
            <a href="../../../index.html">Home</a>
            <a href="../../../library/index.html">Library Reference</a>
            <a href="../../../documentation.html">Documentation</a>
            <a href="https://docs.rs/vb6parse" target="_blank">API Docs</a>
            <a href="https://github.com/scriptandcompile/vb6parse" target="_blank">GitHub</a>
            <button id="theme-toggle" class="theme-toggle" aria-label="Toggle theme">
                <span class="theme-icon">🌙</span>
            </button>
        </div>
    </nav>

    <main class="container">
        
        <article class="library-item">
            <h1 id="formatcurrency-function">FormatCurrency Function</h1>
<p>Returns an expression formatted as a currency value using the currency symbol defined in the system control panel.</p>
<h2 id="syntax">Syntax</h2>
<pre><code class="language-vbnet">FormatCurrency(expression[, numdigitsafterdecimal[, includeleadingdigit[, useparensfornegativenumbers[, groupdigits]]]])</code></pre>
<h2 id="parameters">Parameters</h2>
<ul>
<li><strong>expression</strong>: Required. Expression to be formatted.</li>
<li><strong>numdigitsafterdecimal</strong>: Optional. Numeric value indicating how many places to the right of the decimal are displayed. Default is -1, which indicates the computer's regional settings are used.</li>
<li><strong>includeleadingdigit</strong>: Optional. Tristate constant that indicates whether a leading zero is displayed for fractional values. See Settings for values.</li>
<li><strong>useparensfornegativenumbers</strong>: Optional. Tristate constant that indicates whether to place negative values within parentheses. See Settings for values.</li>
<li><strong>groupdigits</strong>: Optional. Tristate constant that indicates whether numbers are grouped using the group delimiter specified in the computer's regional settings. See Settings for values.</li>
</ul>
<h2 id="settings">Settings</h2>
<p>The includeleadingdigit, useparensfornegativenumbers, and groupdigits arguments have the following settings:
- <strong>vbTrue</strong> (-1): True
- <strong>vbFalse</strong> (0): False
- <strong>vbUseDefault</strong> (-2): Use the setting from the computer's regional settings</p>
<h2 id="return-value">Return Value</h2>
<p>Returns a <code>Variant</code> of subtype <code>String</code> containing the expression formatted as a currency value.</p>
<h2 id="remarks">Remarks</h2>
<p>The <code>FormatCurrency</code> function provides a simple way to format numbers as currency values
using the system's locale settings. It automatically applies the currency symbol, decimal
separator, thousand separator, and negative number formatting according to regional settings.
<strong>Important Characteristics:</strong>
- Uses system locale for currency symbol and formatting
- Default: 2 decimal places (from regional settings)
- Automatically adds thousand separators
- Negative numbers can be displayed with parentheses or minus sign
- Leading zeros controlled by regional settings or parameter
- Currency symbol position depends on locale (before or after amount)
- Returns empty string if expression is Null
- More convenient than <code>Format</code> for simple currency formatting
- Less flexible than <code>Format</code> for custom patterns
- Locale-aware (respects user's regional settings)</p>
<h2 id="typical-uses">Typical Uses</h2>
<ul>
<li>Display prices and monetary amounts</li>
<li>Format financial reports</li>
<li>Show invoice totals</li>
<li>Display account balances</li>
<li>Format transaction amounts</li>
<li>Create currency-formatted exports</li>
<li>Display budget figures</li>
<li>Show cost calculations</li>
</ul>
<h2 id="examples">Examples</h2>
<h3 id="basic-usage">Basic Usage</h3>
<pre><code class="language-vbnet">Dim amount As Double
amount = 1234.567
&#x27; Default formatting (2 decimal places, system settings)
Debug.Print FormatCurrency(amount)           &#x27; $1,234.57
&#x27; No decimal places
Debug.Print FormatCurrency(amount, 0)        &#x27; $1,235
&#x27; Three decimal places
Debug.Print FormatCurrency(amount, 3)        &#x27; $1,234.567
&#x27; Negative with parentheses
Debug.Print FormatCurrency(-500, , , vbTrue) &#x27; ($500.00)</code></pre>
<h3 id="handling-negative-values">Handling Negative Values</h3>
<pre><code class="language-vbnet">Dim balance As Double
balance = -1250.50
&#x27; Default negative (with minus sign)
Debug.Print FormatCurrency(balance)          &#x27; -$1,250.50
&#x27; Parentheses for negative
Debug.Print FormatCurrency(balance, 2, , vbTrue)  &#x27; ($1,250.50)
&#x27; No parentheses (explicit)
Debug.Print FormatCurrency(balance, 2, , vbFalse) &#x27; -$1,250.50</code></pre>
<h3 id="control-leading-digits">Control Leading Digits</h3>
<pre><code class="language-vbnet">Dim fraction As Double
fraction = 0.75
&#x27; With leading zero (default)
Debug.Print FormatCurrency(fraction)         &#x27; $0.75
&#x27; No leading zero
Debug.Print FormatCurrency(fraction, 2, vbFalse)  &#x27; $.75
&#x27; Explicit leading zero
Debug.Print FormatCurrency(fraction, 2, vbTrue)   &#x27; $0.75</code></pre>
<h2 id="common-patterns">Common Patterns</h2>
<h3 id="format-invoice-line-items">Format Invoice Line Items</h3>
<pre><code class="language-vbnet">Sub DisplayInvoiceLines(items As Collection)
    Dim item As Variant
    Dim total As Double
    Debug.Print &quot;Item&quot;, &quot;Quantity&quot;, &quot;Price&quot;, &quot;Amount&quot;
    Debug.Print String(60, &quot;-&quot;)
    total = 0
    For Each item In items
        Debug.Print item.Name, _
                    item.Quantity, _
                    FormatCurrency(item.Price), _
                    FormatCurrency(item.Quantity * item.Price)
        total = total + (item.Quantity * item.Price)
    Next item
    Debug.Print String(60, &quot;-&quot;)
    Debug.Print &quot;Total:&quot;, , , FormatCurrency(total)
End Sub</code></pre>
<h3 id="format-account-balance-with-parentheses">Format Account Balance with Parentheses</h3>
<pre><code class="language-vbnet">Function FormatAccountBalance(balance As Double) As String
    &#x27; Show negative balances in parentheses (accounting style)
    FormatAccountBalance = FormatCurrency(balance, 2, vbTrue, vbTrue, vbTrue)
End Function
&#x27; Usage
Debug.Print FormatAccountBalance(1500)       &#x27; $1,500.00
Debug.Print FormatAccountBalance(-250.50)    &#x27; ($250.50)</code></pre>
<h3 id="create-price-display">Create Price Display</h3>
<pre><code class="language-vbnet">Function FormatPrice(price As Double, showCents As Boolean) As String
    If showCents Then
        FormatPrice = FormatCurrency(price, 2)
    Else
        FormatPrice = FormatCurrency(price, 0)
    End If
End Function
&#x27; Usage
Debug.Print FormatPrice(19.99, True)         &#x27; $19.99
Debug.Print FormatPrice(19.99, False)        &#x27; $20</code></pre>
<h3 id="display-transaction-summary">Display Transaction Summary</h3>
<pre><code class="language-vbnet">Sub ShowTransactionSummary(credits As Double, debits As Double)
    Dim balance As Double
    Debug.Print &quot;Transaction Summary&quot;
    Debug.Print String(40, &quot;=&quot;)
    Debug.Print &quot;Credits:  &quot;, FormatCurrency(credits)
    Debug.Print &quot;Debits:   &quot;, FormatCurrency(debits, 2, , vbTrue)
    Debug.Print String(40, &quot;-&quot;)
    balance = credits - debits
    Debug.Print &quot;Balance:  &quot;, FormatCurrency(balance, 2, , vbTrue)
End Sub</code></pre>
<h3 id="format-budget-report">Format Budget Report</h3>
<pre><code class="language-vbnet">Sub PrintBudgetReport()
    Dim budgeted As Double
    Dim actual As Double
    Dim variance As Double
    budgeted = 50000
    actual = 48500
    variance = actual - budgeted
    Debug.Print &quot;Budget Report&quot;
    Debug.Print String(50, &quot;=&quot;)
    Debug.Print &quot;Budgeted:&quot;, FormatCurrency(budgeted, 0)
    Debug.Print &quot;Actual:  &quot;, FormatCurrency(actual, 0)
    Debug.Print &quot;Variance:&quot;, FormatCurrency(variance, 0, , vbTrue)
    If variance &lt; 0 Then
        Debug.Print &quot;Status: Under budget&quot;
    Else
        Debug.Print &quot;Status: Over budget&quot;
    End If
End Sub</code></pre>
<h3 id="listboxcombobox-population"><code>ListBox</code>/<code>ComboBox</code> Population</h3>
<pre><code class="language-vbnet">Sub PopulatePriceList(lstPrices As ListBox, prices() As Double)
    Dim i As Long
    lstPrices.Clear
    For i = LBound(prices) To UBound(prices)
        lstPrices.AddItem FormatCurrency(prices(i))
    Next i
End Sub</code></pre>
<h3 id="format-for-database-display">Format for Database Display</h3>
<pre><code class="language-vbnet">Function GetFormattedPrice(rs As ADODB.Recordset, fieldName As String) As String
    If IsNull(rs.Fields(fieldName).Value) Then
        GetFormattedPrice = &quot;N/A&quot;
    Else
        GetFormattedPrice = FormatCurrency(rs.Fields(fieldName).Value)
    End If
End Function</code></pre>
<h3 id="calculate-and-display-tax">Calculate and Display Tax</h3>
<pre><code class="language-vbnet">Function DisplayPriceWithTax(basePrice As Double, taxRate As Double) As String
    Dim tax As Double
    Dim total As Double
    tax = basePrice * taxRate
    total = basePrice + tax
    DisplayPriceWithTax = &quot;Price: &quot; &amp; FormatCurrency(basePrice) &amp; vbCrLf &amp; _
                          &quot;Tax: &quot; &amp; FormatCurrency(tax) &amp; vbCrLf &amp; _
                          &quot;Total: &quot; &amp; FormatCurrency(total)
End Function
&#x27; Usage
MsgBox DisplayPriceWithTax(100, 0.08)</code></pre>
<h3 id="format-payment-schedule">Format Payment Schedule</h3>
<pre><code class="language-vbnet">Sub ShowPaymentSchedule(loanAmount As Double, months As Integer, rate As Double)
    Dim payment As Double
    Dim i As Integer
    Dim balance As Double
    payment = loanAmount / months
    balance = loanAmount
    Debug.Print &quot;Payment Schedule&quot;
    Debug.Print String(50, &quot;=&quot;)
    Debug.Print &quot;Month&quot;, &quot;Payment&quot;, &quot;Balance&quot;
    Debug.Print String(50, &quot;-&quot;)
    For i = 1 To months
        Debug.Print i, FormatCurrency(payment), FormatCurrency(balance)
        balance = balance - payment
    Next i
End Sub</code></pre>
<h3 id="compare-values">Compare Values</h3>
<pre><code class="language-vbnet">Function ComparePrices(price1 As Double, price2 As Double) As String
    Dim difference As Double
    difference = price1 - price2
    ComparePrices = FormatCurrency(price1) &amp; &quot; vs &quot; &amp; FormatCurrency(price2) &amp; _
                    &quot; (Difference: &quot; &amp; FormatCurrency(difference, 2, , vbTrue) &amp; &quot;)&quot;
End Function</code></pre>
<h3 id="shopping-cart-total">Shopping Cart Total</h3>
<pre><code class="language-vbnet">Function GetCartSummary(items As Collection) As String
    Dim item As Variant
    Dim subtotal As Double
    Dim tax As Double
    Dim shipping As Double
    Dim total As Double
    subtotal = 0
    For Each item In items
        subtotal = subtotal + (item.Price * item.Quantity)
    Next item
    tax = subtotal * 0.08
    shipping = 5.99
    total = subtotal + tax + shipping
    GetCartSummary = &quot;Subtotal: &quot; &amp; FormatCurrency(subtotal) &amp; vbCrLf &amp; _
                     &quot;Tax:      &quot; &amp; FormatCurrency(tax) &amp; vbCrLf &amp; _
                     &quot;Shipping: &quot; &amp; FormatCurrency(shipping) &amp; vbCrLf &amp; _
                     &quot;Total:    &quot; &amp; FormatCurrency(total)
End Function</code></pre>
<h2 id="advanced-usage">Advanced Usage</h2>
<h3 id="flexible-currency-formatter">Flexible Currency Formatter</h3>
<pre><code class="language-vbnet">Function FormatCurrencyEx(amount As Double, _
                          Optional decimals As Integer = 2, _
                          Optional useParens As Boolean = True, _
                          Optional useGroups As Boolean = True) As String
    Dim leadingDigit As VbTriState
    Dim parens As VbTriState
    Dim groups As VbTriState
    leadingDigit = vbTrue
    parens = IIf(useParens, vbTrue, vbFalse)
    groups = IIf(useGroups, vbTrue, vbFalse)
    FormatCurrencyEx = FormatCurrency(amount, decimals, leadingDigit, parens, groups)
End Function</code></pre>
<h3 id="multi-currency-support">Multi-Currency Support</h3>
<pre><code class="language-vbnet">Function FormatMultiCurrency(amount As Double, currencyCode As String) As String
    &#x27; Simple multi-currency display (uses FormatCurrency then replaces symbol)
    Dim formatted As String
    formatted = FormatCurrency(amount)
    Select Case UCase(currencyCode)
        Case &quot;USD&quot;
            &#x27; Keep default $ symbol
            FormatMultiCurrency = formatted
        Case &quot;EUR&quot;
            FormatMultiCurrency = Replace(formatted, &quot;$&quot;, &quot;&quot;)
        Case &quot;GBP&quot;
            FormatMultiCurrency = Replace(formatted, &quot;$&quot;, &quot;£&quot;)
        Case &quot;JPY&quot;
            FormatMultiCurrency = Replace(formatted, &quot;$&quot;, &quot;¥&quot;)
            FormatMultiCurrency = Replace(FormatMultiCurrency, &quot;.00&quot;, &quot;&quot;)
        Case Else
            FormatMultiCurrency = currencyCode &amp; &quot; &quot; &amp; Format(amount, &quot;#,##0.00&quot;)
    End Select
End Function</code></pre>
<h3 id="financial-statement-formatter">Financial Statement Formatter</h3>
<pre><code class="language-vbnet">Type FinancialLine
    Description As String
    Amount As Double
    IsSubtotal As Boolean
End Type
Function FormatFinancialStatement(lines() As FinancialLine) As String
    Dim result As String
    Dim i As Long
    Dim line As String
    result = &quot;Financial Statement&quot; &amp; vbCrLf
    result = result &amp; String(60, &quot;=&quot;) &amp; vbCrLf
    For i = LBound(lines) To UBound(lines)
        line = lines(i).Description
        &#x27; Right-align amounts
        line = line &amp; Space(40 - Len(line))
        line = line &amp; FormatCurrency(lines(i).Amount, 2, vbTrue, vbTrue, vbTrue)
        If lines(i).IsSubtotal Then
            result = result &amp; String(60, &quot;-&quot;) &amp; vbCrLf
        End If
        result = result &amp; line &amp; vbCrLf
    Next i
    FormatFinancialStatement = result
End Function</code></pre>
<h3 id="dynamic-precision-formatter">Dynamic Precision Formatter</h3>
<pre><code class="language-vbnet">Function FormatCurrencyDynamic(amount As Double) As String
    &#x27; Use different precision based on amount magnitude
    If Abs(amount) &gt;= 1000000 Then
        &#x27; Millions: no decimals
        FormatCurrencyDynamic = FormatCurrency(amount, 0) &amp; &quot;M&quot;
    ElseIf Abs(amount) &gt;= 1000 Then
        &#x27; Thousands: no decimals
        FormatCurrencyDynamic = FormatCurrency(amount, 0)
    ElseIf Abs(amount) &gt;= 1 Then
        &#x27; Regular: 2 decimals
        FormatCurrencyDynamic = FormatCurrency(amount, 2)
    Else
        &#x27; Small amounts: 4 decimals
        FormatCurrencyDynamic = FormatCurrency(amount, 4)
    End If
End Function</code></pre>
<h3 id="conditional-formatting">Conditional Formatting</h3>
<pre><code class="language-vbnet">Function FormatProfitLoss(amount As Double) As String
    &#x27; Format with color indicators for profit/loss
    If amount &gt; 0 Then
        FormatProfitLoss = &quot;[GREEN]+&quot; &amp; FormatCurrency(amount)
    ElseIf amount &lt; 0 Then
        FormatProfitLoss = &quot;[RED]&quot; &amp; FormatCurrency(amount, 2, , vbTrue)
    Else
        FormatProfitLoss = &quot;[BLACK]&quot; &amp; FormatCurrency(0)
    End If
End Function</code></pre>
<h3 id="gridreport-alignment">Grid/Report Alignment</h3>
<pre><code class="language-vbnet">Function FormatCurrencyAligned(amount As Double, width As Integer) As String
    Dim formatted As String
    formatted = FormatCurrency(amount, 2, vbTrue, vbTrue, vbTrue)
    &#x27; Right-align in field
    If Len(formatted) &lt; width Then
        FormatCurrencyAligned = Space(width - Len(formatted)) &amp; formatted
    Else
        FormatCurrencyAligned = formatted
    End If
End Function</code></pre>
<h2 id="error-handling">Error Handling</h2>
<pre><code class="language-vbnet">Function SafeFormatCurrency(value As Variant, _
                            Optional decimals As Integer = 2) As String
    On Error GoTo ErrorHandler
    If IsNull(value) Then
        SafeFormatCurrency = &quot;N/A&quot;
    ElseIf Not IsNumeric(value) Then
        SafeFormatCurrency = &quot;Invalid&quot;
    Else
        SafeFormatCurrency = FormatCurrency(CDbl(value), decimals)
    End If
    Exit Function
ErrorHandler:
    Select Case Err.Number
        Case 13  &#x27; Type mismatch
            SafeFormatCurrency = &quot;Type Error&quot;
        Case 6   &#x27; Overflow
            SafeFormatCurrency = &quot;Overflow&quot;
        Case Else
            SafeFormatCurrency = &quot;Error&quot;
    End Select
End Function</code></pre>
<h3 id="common-errors">Common Errors</h3>
<ul>
<li><strong>Error 13</strong> (Type Mismatch): Expression cannot be converted to numeric</li>
<li><strong>Error 6</strong> (Overflow): Value too large for <code>Double</code></li>
<li><strong>Error 5</strong> (Invalid procedure call): Invalid decimal places parameter</li>
</ul>
<h2 id="performance-considerations">Performance Considerations</h2>
<ul>
<li><code>FormatCurrency</code> is fast for simple formatting</li>
<li>Slightly slower than <code>Format</code> for custom patterns</li>
<li>Faster than building format strings manually</li>
<li>Locale lookups cached by system</li>
<li>Avoid repeated calls in tight loops if possible</li>
<li>Consider caching formatted values for display</li>
</ul>
<h2 id="best-practices">Best Practices</h2>
<h3 id="use-formatcurrency-for-user-facing-amounts">Use <code>FormatCurrency</code> for User-Facing Amounts</h3>
<pre><code class="language-vbnet">&#x27; Good - Locale-aware, user-friendly
lblPrice.Caption = FormatCurrency(price)
&#x27; Less portable - Hard-coded format
lblPrice.Caption = &quot;$&quot; &amp; Format(price, &quot;0.00&quot;)</code></pre>
<h3 id="handle-null-values">Handle <code>Null</code> Values</h3>
<pre><code class="language-vbnet">&#x27; Good - Check for Null
If Not IsNull(amount) Then
    formatted = FormatCurrency(amount)
Else
    formatted = &quot;N/A&quot;
End If</code></pre>
<h3 id="be-consistent-with-negative-formatting">Be Consistent with Negative Formatting</h3>
<pre><code class="language-vbnet">&#x27; Good - Use same style throughout application
Const USE_PARENS = vbTrue
formatted = FormatCurrency(balance, 2, , USE_PARENS)</code></pre>
<h2 id="comparison-with-other-functions">Comparison with Other Functions</h2>
<h3 id="formatcurrency-vs-format"><code>FormatCurrency</code> vs <code>Format</code></h3>
<pre><code class="language-vbnet">&#x27; FormatCurrency - Simple, locale-aware
result = FormatCurrency(1234.56)
&#x27; Format - More control, custom patterns
result = Format(1234.56, &quot;$#,##0.00&quot;)</code></pre>
<h3 id="formatcurrency-vs-formatnumber"><code>FormatCurrency</code> vs <code>FormatNumber</code></h3>
<pre><code class="language-vbnet">&#x27; FormatCurrency - Adds currency symbol
result = FormatCurrency(1234.56)        &#x27; $1,234.56
&#x27; FormatNumber - No currency symbol
result = FormatNumber(1234.56)          &#x27; 1,234.56</code></pre>
<h3 id="formatcurrency-vs-strcstr"><code>FormatCurrency</code> vs <code>Str</code>/<code>CStr</code></h3>
<pre><code class="language-vbnet">&#x27; FormatCurrency - Full formatting
result = FormatCurrency(1234.56)        &#x27; $1,234.56
&#x27; Str - Basic conversion, no formatting
result = Str(1234.56)                   &#x27; &quot; 1234.56&quot;
&#x27; CStr - Basic conversion
result = CStr(1234.56)                  &#x27; &quot;1234.56&quot;</code></pre>
<h2 id="limitations">Limitations</h2>
<ul>
<li>Uses system locale (cannot specify different locale)</li>
<li>Limited to system's currency symbol</li>
<li>Cannot customize symbol position</li>
<li>All parameters optional, making errors less obvious</li>
<li>Tristate parameters can be confusing</li>
<li>No built-in rounding mode control</li>
<li>Cannot format multiple currencies in same session</li>
</ul>
<h2 id="regional-settings-impact">Regional Settings Impact</h2>
<p>The <code>FormatCurrency</code> function behavior varies by locale:
- <strong>United States</strong>: $1,234.56
- <strong>United Kingdom</strong>: £1,234.56
- <strong>European Union</strong>: €1.234,56 (note decimal/thousand separators)
- <strong>Japan</strong>: ¥1,235 (typically no decimal places)</p>
<h2 id="related-functions">Related Functions</h2>
<ul>
<li><code>Format</code>: More flexible formatting with custom patterns</li>
<li><code>FormatNumber</code>: Format numbers without currency symbol</li>
<li><code>FormatPercent</code>: Format numbers as percentages</li>
<li><code>FormatDateTime</code>: Format date/time values</li>
<li><code>CCur</code>: Convert expression to <code>Currency</code> type</li>
<li><code>CDbl</code>: Convert expression to <code>Double</code> type</li>
</ul>
        </article>
        
        <div style="margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border-color);">
            <p>
                <a href="index.html">← Back to String</a> |
                <a href="../index.html">View all functions</a>
            </p>
        </div>

    </main>

    <footer>
        <div class="container">
            <p>&copy; 2024-2026 VB6Parse Contributors. Licensed under the MIT License.</p>
        </div>
    </footer>
</body>
</html>