How do I convert string to double
-
Hi all, C# as my language of choice. I have a web page that accepts input into a text box and in the button click the value should be converted to double for computation to take place. I mean: a = Convert.Todouble(textbox1.text); I keep getting this error: "You can't implicitly conver string to double" please show me the way out! thanks in advance
-
Hi all, C# as my language of choice. I have a web page that accepts input into a text box and in the button click the value should be converted to double for computation to take place. I mean: a = Convert.Todouble(textbox1.text); I keep getting this error: "You can't implicitly conver string to double" please show me the way out! thanks in advance
-
Hi all, C# as my language of choice. I have a web page that accepts input into a text box and in the button click the value should be converted to double for computation to take place. I mean: a = Convert.Todouble(textbox1.text); I keep getting this error: "You can't implicitly conver string to double" please show me the way out! thanks in advance
Hmm. the above should work because the ToDouble has an overload that takes a String object. Are you sure the error occurs at this line? Alternatively you could try using
double.TryParse
. Personally, I preferTryParse
overToDouble
anyway.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
-
Hi all, C# as my language of choice. I have a web page that accepts input into a text box and in the button click the value should be converted to double for computation to take place. I mean: a = Convert.Todouble(textbox1.text); I keep getting this error: "You can't implicitly conver string to double" please show me the way out! thanks in advance
this value "a" is a string type?
-
Hi all, C# as my language of choice. I have a web page that accepts input into a text box and in the button click the value should be converted to double for computation to take place. I mean: a = Convert.Todouble(textbox1.text); I keep getting this error: "You can't implicitly conver string to double" please show me the way out! thanks in advance
this value "a" is string type?
-
Hi all, C# as my language of choice. I have a web page that accepts input into a text box and in the button click the value should be converted to double for computation to take place. I mean: a = Convert.Todouble(textbox1.text); I keep getting this error: "You can't implicitly conver string to double" please show me the way out! thanks in advance
Also, pay attentionto the number format used by the local machine. You may get errors if the decimal separator used by the local machine is "," and the user inputs "." as a separator or viceversa. You can see it under Local Settings in Control Panel.
-
Also, pay attentionto the number format used by the local machine. You may get errors if the decimal separator used by the local machine is "," and the user inputs "." as a separator or viceversa. You can see it under Local Settings in Control Panel.
for that you could use the overload to try parse that takes an IFormatter input aswell. RUssell