没有验证
退格情况后,会再度调用这个方法,这时文本框为空,无法转换为double型。
Regex x = new Regex("^[0-9]*$");
if (x.IsMatch(textBox1.Text)&&textBox1.Text!="")
{
a = Convert.ToDouble(textBox1.Text);
b = a * 0.56;
textBox2.Text = Convert.ToString(b);
c = (int)b;
textBox3.Text = Convert.ToString(c);
d = b - c;
textBox4.Text = Convert.ToString(d);
}
else
{
MessageBox.Show("There are something wrong!", "ERROR");
}
其实我也不知道,我来看看各位大侠是怎么解决的,我也是刚学C#