decimal seperator

  • Thread starter Thread starter G-REX
  • Start date Start date
G

G-REX

Guest
In my application i am filling in some textboxes where the value is a double. The problem is that you don't know what the decimal seperator is on a computer using your application (this can be a . or a , ).

for example:

var1 = cdbl(textbox.text) 'value of the textbox is 1.7
or
var2 = cdbl(textbox.text) 'value of the textbox is 1,7

When the decimal seperator of the operating system is a . then you get for var1 the value 1.7 and for var2 the value 17

How can i catch this so the user doesn't need to worry about a . or , when filling in this form?

Is there a command where i can get the default seperator of the operating system? Or some other way to catch this problem?

I hope someone has the answer to this "little" problem.
tnx
 
I'd suggest using Double.Parse rather than CDbl. I think the function is aware of the current locale and this should be handled automatically for you.
 
sorry, but it doesn't work, i still have the same problem with it. Tnx anyway.

There must be a solution... anyone? :'(
 
It would only parse out , correctly if the current locale was set
to something that used , as decimal seperator. Try setting your
decimal seperator to , and trying it again.
 
Back
Top