所以我有多个不同的单选按钮,在不同的组框中。在用户能够“保存”他们的表单之前,需要填写所有字段。所以我试图确保所有单选按钮都已填充。此刻,我正尝试使用以下代码:WinForms中的单选按钮验证
if (!(this.RoundTrip.Checked || this.OneWay.Checked))
{
MessageBox.Show("Select an option for Trip Type");
if (!(this.NorthRad.Checked || this.ExpressRad.Checked || this.ExpressRad.Checked))
{
MessageBox.Show("Select an Option for Route Type");
}
if (!(this.YesNeeded.Checked || this.NotNeeded.Checked))
{
MessageBox.Show("Select an option for accessibility");
}
if (this.AdultNum.Value == 0 && this.SeniorNum.Value == 0 && this.ChildNum.Value == 0)
{
MessageBox.Show("Select at least one ticket");
}
return;
}
与此代码,它不允许我点击保存按钮,但没有消息框出现。即使在我填写收音机框后,我也无法点击保存按钮。任何帮助,将不胜感激。