Transforming TextBox.text into double

  • Thread starter Thread starter Tobias Froehlich
  • Start date Start date
T

Tobias Froehlich

Hello!

I have a short question.

I have a TextBox in which the user can enter a number, which then has
to be saved into a double variable.

The line I have looks like this:

gpm.Configuration.LearnRate = TextBox1.Text;

whereas the first part is a double variable.

Now of course this doesn't work because TextBox1.Text is a string..
what can I do here?

Thank you very much!
 
Tobias said:
Hello!

I have a short question.

I have a TextBox in which the user can enter a number, which then has
to be saved into a double variable.

The line I have looks like this:

gpm.Configuration.LearnRate = TextBox1.Text;

whereas the first part is a double variable.

Now of course this doesn't work because TextBox1.Text is a string..
what can I do here?

Thank you very much!

Convert.ToDouble()
double.Parse()
double.TryParse()
 
Back
Top