Formatting a String As Currency

cjohnson

Well-known member
Joined
Sep 21, 2006
Messages
63
Location
WV
Programming Experience
1-3
I am formatting a string as currency as follows:

VB.NET:
AM.Text = Format(AM.Text, "Currency")

Can anyone tell me a simple way to format this Euro (€1.000,00)?
 
Take it the string is a pure number (validated and converted), this example starts with the Double number and formats it as currency string, this is from the doc help topic Formatting Numeric Data for a Specific Culture, most of is regarding 'Formatting Currency for Euro Nations'.
VB.NET:
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] money [/SIZE][SIZE=2][COLOR=#0000ff]As [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Double[/COLOR][/SIZE][SIZE=2] = 1.23[/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] euro [/SIZE][SIZE=2][COLOR=#0000ff]As [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2] = money.ToString([/SIZE][SIZE=2][COLOR=#800000]"c"[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] Globalization.CultureInfo([/SIZE][SIZE=2][COLOR=#800000]"fr-FR"[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]False[/COLOR][/SIZE][SIZE=2]))[/SIZE]
[SIZE=2]MsgBox(euro)[/SIZE]
 
like this

VB.NET:
dim s as string
dim d as decimal
 
d = 234.55
 
s = Format(d, "c")
or
VB.NET:
dim d as decimal = 234.44
txtbox.text = Format(d,"c")
 
Back
Top