private void button1_Click(object sender, EventArgs e)
{
int num1, num2;
double result;
try
{
if (textBox1.Text == null || textBox2.Text == null)
MessageBox.Show("输入不完整!");
else
{
num1 = Convert.ToInt32(textBox1.Text);
num2 = Convert.ToInt32(textBox2.Text);
result = checked(num1 + num2);
textBox3.Text = Convert.ToString(result);
}
}
catch (OverflowException)
{
textBox3.Text = "加法溢出!";
}
}
这样做还是不行呀 帮修改一下代码吧~~~