当输入两个int类型的数,还是会弹出“必须输入两个数字!”的对话框,不明白
private void Btn_jia_Click(object sender, EventArgs e)
{
JudgeTextBox();
Button btn = sender as Button;
}
private void S(Button btn)
{
Count sum = Result.result(btn.Text);
txt_count.Text = sum.count(Convert.ToInt32(txt_frist.Text), Convert.ToInt32(txt_scoend.Text)).ToString();
}
private void JudgeTextBox()
{
int num = 0;
if (txt_frist.Text == "" || txt_scoend.Text == "")
{
MessageBox.Show("必须输入两个被操作的数!");
return;
}
else if ((!int.TryParse(txt_count.Text, out num)) || (!int.TryParse(txt_scoend.Text, out num)))
{
MessageBox.Show("必须输入两个数字!");
return;
}
} |