Input string was not in a correct format #2

后端 未结 10 1279
一向
一向 2020-12-03 21:24
double temp;
temp = (double)Convert.ToDouble(\"1234.5678\");

Hey Lads and Ladies, I can\'t for the life of me figure out why the above line isn\'t

10条回答
  •  一个人的身影
    2020-12-03 21:45

    I found the problem when you let the text box empty then this error occurs so try this one to handle it.

    An unhandled exception of type System.FormatException occurred in mscorlib.dll Additional information: Input string was not in a correct format.

    if (!string.IsNullOrEmpty(Txt1.Text)) {int _qty = (int)Convert.ToInt32(Txt1.Text);}
    

提交回复
热议问题