Format Double to String

olgage

New member
Joined
Nov 14, 2006
Messages
4
Programming Experience
Beginner
Hello!
I've just began to write VB.NET.

I have a double number (like 24.8745).
I must convert it to a String in format
<integer part>.<fraction>.

When I work in English OS - everything is OK.
The problem is when my program run in German OS.
Then the casting toString() returns format
<integer part>,<fraction>.

I need to convert my double to String with POINT in the middle (not ","). It's important.

Can you help me?
Thank you.
 
Example Double to US culture string (even if current culture is different):
VB.NET:
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] d [/SIZE][SIZE=2][COLOR=#0000ff]As [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Double[/COLOR][/SIZE][SIZE=2] = 1.2345[/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] number [/SIZE][SIZE=2][COLOR=#0000ff]As [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2] = d.ToString([/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] Globalization.CultureInfo([/SIZE][SIZE=2][COLOR=#800000]"en-US"[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]False[/COLOR][/SIZE][SIZE=2]))[/SIZE]
[SIZE=2]MsgBox(number)[/SIZE]
 
Back
Top