Guest G-REX Posted December 5, 2002 Posted December 5, 2002 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 Quote
*Gurus* divil Posted December 5, 2002 *Gurus* Posted December 5, 2002 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. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Guest G-REX Posted December 8, 2002 Posted December 8, 2002 sorry, but it doesn't work, i still have the same problem with it. Tnx anyway. There must be a solution... anyone? :'( Quote
*Experts* Volte Posted December 8, 2002 *Experts* Posted December 8, 2002 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.