Answer the question
In order to leave comments, you need to log in
How to extract number with dot from textbox?
Good evening!
Such problem:
from textbox'a value is taken out and written down in a variable. double x = double.Parse(TextBox1.Text);
But as soon as I enter the number
0.5 into the textbox, everything crashes with an error.
How do I still extract numbers of this type?
Answer the question
In order to leave comments, you need to log in
Either just:
Or difficult :
double = double.Parse(TextBox1.Text, CultureInfo.GetCultureInfo("ru-RU").NumberFormat);
Better something like this:
If you simply replace the dot with a comma, it will not work for those who have a dot set in the OS.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question