[RESOLVED]Convert Comma to Point
Hello;
When i save my variables to text all point convert to comma. Like below
Var1=2.2
if i save it to text
Print #1, Var1
it's look like 2,2 in text.
I rearange regional settings thus my problem fixed but wonder how can i save my data with point without make any changement on regional settings.
Thanks
Re: Convert Comma to Point
Re: Convert Comma to Point
Re: Convert Comma to Point
Re: Convert Comma to Point
In my view no problem in this code.
:) :) :)
Code:
Var1 = 2.2
filenum1 = FreeFile
Open "c:\1.txt" For Output As filenum1
Print #1, Var1
Re: Convert Comma to Point
If you find any error in your code or in your setting please let us know in the forums, so that the junior programers can avoid such mistakes like me.
Re: Convert Comma to Point
What Hack is saying is this:
Code:
Dim var1 as string
Var1 = "2.2"
filenum1 = FreeFile
Open "c:\1.txt" For Output As filenum1
Print #1, Var1
Or
Code:
Var1 = 2.2
filenum1 = FreeFile
Open "c:\1.txt" For Output As filenum1
Print #1, CStr(Var1)
Re: Convert Comma to Point
Options:
Str$(Var1)
Replace(CStr(Var1), ",", ".")
The problem here is locale settings, VB uses locale with certain functions. CStr, Format$ etc. use the system locale settings when handling values.
Re: Convert Comma to Point
Hi;
Print #1, Replace(CStr(Tbn1), ",", ".") worked.
Thanks everybody who helped