Converting a string to a double
-
Hi everybody!!! I have a TextBox in which user write a float number. Decimal separator is the dot ".". I have to save the Text of the textbox into a numeric variable... i chosen a double variable. But when I call Convert.ToDouble(myString) method and myString is, for example 1.5, the number written in the variable is 15. How can I solve this problem? thank you
-
Hi everybody!!! I have a TextBox in which user write a float number. Decimal separator is the dot ".". I have to save the Text of the textbox into a numeric variable... i chosen a double variable. But when I call Convert.ToDouble(myString) method and myString is, for example 1.5, the number written in the variable is 15. How can I solve this problem? thank you
-
You have to specify the correct CultureInfo or NumberFormatInfo object when you convert the number. Now you are using the default culture, and that obviously uses a comma for decimal separator as it ignores the period. --- b { font-weight: normal; }
ok, but with the comma I had the same problem...now I try with the culture info thankyou
-
You have to specify the correct CultureInfo or NumberFormatInfo object when you convert the number. Now you are using the default culture, and that obviously uses a comma for decimal separator as it ignores the period. --- b { font-weight: normal; }
I found the problem, thanks for your help Alessio