README.md

December 4, 2022 ยท View on GitHub

formatcurrency

Description

format a text field into a $ currency field.

More Info

text box name

Call teh module by passing any text box name that you want to have as a currency text box.

formatted value in $

Submitted On
ByVikramjit Singh
LevelUnknown
User Rating4.2 (161 globes from 38 users)
CompatibilityVB 4.0 (32-bit), VB 5.0, VB 6.0
CategoryString Manipulation
WorldVisual Basic
Archive File

API Declarations

'put as many text boxes as you want...say text1
'call the class by using the following line
Call validate(Text1)

Source Code

Sub validate(textboxname As TextBox)
If KeyAscii > Asc(9) Or KeyAscii < Asc(0) Then
KeyAscii = 0
End If
mypos = InStr(1, textboxname.Text, ".")
If mypos <> 0 Then
textboxname.Text = Format(textboxname.Text, "$###,###,###,###.##")
Else
textboxname.Text = Format(textboxname.Text, "$###,###,###,###")
End If
End Sub