I searched in "StackOverflow" but I couldn't find the answer. My question: I want to write a project with asp.net related to the numbers. It need work with "Decimal" data (EX: 19.5), but in some countries like canada instead of . they use , that means if I write this code, I'll face with the error:
'in Canada
Dim A as Double = Convert.ToDouble("19.5") 'Error
Dim A as Double = Convert.ToDouble("19,5") 'OK
'in USA
Dim A as Double = Convert.ToDouble("19.5") 'OK
Dim A as Double = Convert.ToDouble("19,5") 'Error
I want my code work for all countries like USA which use 19.5 instead of 19,5.
- How can I check the Regional and language setting and accept 19.5 in USA and 19,5 in Canada.
- Or, How can I accept both in my program, without manipulating the string or using Validator or try-catch.
I appreciate you in advanced.