How to assign text control's value to a numeric variable?
-
Hi All, How can I assign a Text control's Text value to a numeric datatype. If I do like this double temp = Text1.Text gives compile time error. In case if I cast as follows double temp=(double) Text1.Text gives run time error as invalid cast. Some body had suggested me to use TryParse() ot Parse method of numeric data type. But I do see any method for numeric data type namely TryParse() or Parse(). I have .NET Framework 1.1 and VS 2003. Regards, Amol
Every thing will come to you if you have faith.
-
Hi All, How can I assign a Text control's Text value to a numeric datatype. If I do like this double temp = Text1.Text gives compile time error. In case if I cast as follows double temp=(double) Text1.Text gives run time error as invalid cast. Some body had suggested me to use TryParse() ot Parse method of numeric data type. But I do see any method for numeric data type namely TryParse() or Parse(). I have .NET Framework 1.1 and VS 2003. Regards, Amol
Every thing will come to you if you have faith.
In Framework 1.1 there's no
TryParse
but aParse
method.double temp = Double.Parse(Text1.Text);
"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, How can I assign a Text control's Text value to a numeric datatype. If I do like this double temp = Text1.Text gives compile time error. In case if I cast as follows double temp=(double) Text1.Text gives run time error as invalid cast. Some body had suggested me to use TryParse() ot Parse method of numeric data type. But I do see any method for numeric data type namely TryParse() or Parse(). I have .NET Framework 1.1 and VS 2003. Regards, Amol
Every thing will come to you if you have faith.
-
Hi All, How can I assign a Text control's Text value to a numeric datatype. If I do like this double temp = Text1.Text gives compile time error. In case if I cast as follows double temp=(double) Text1.Text gives run time error as invalid cast. Some body had suggested me to use TryParse() ot Parse method of numeric data type. But I do see any method for numeric data type namely TryParse() or Parse(). I have .NET Framework 1.1 and VS 2003. Regards, Amol
Every thing will come to you if you have faith.