【发布时间】:2015-01-17 08:51:20
【问题描述】:
private void button1_Click(object sender, EventArgs e)
{
if (radioButton1.Checked || radioButton2.Checked || radioButton3.Checked)
{
Form3 objd = new Form3(tp, m, l);
objd.Show();
this.Hide();
}
else if (!radioButton3.Checked && !radioButton2.Checked && !radioButton1.Checked)
{
MessageBox.Show("Please select any class");
}
}
我在按钮单击事件中有这些 if 语句,当它的调试和单选按钮之一被选中时,即使消息框显示它没有显示表单 3 我想知道“||”可能有问题或运算符
【问题讨论】:
-
||的问题非常不太可能:首先在调试器中检查三个按钮的Checked属性的值(或通过记录)。 -
正是这个^。您绝对不会发现核心语言运算符有问题。
标签: c# if-statement radio-button logical-operators