当我不选择单选按钮时,MessageBox应该显示

时间:2018-07-05 06:57:30

标签: vb.net

enter image description here

If rad0.Checked = False AndAlso rad1.Checked = False AndAlso rad12mmtongue.Checked = False AndAlso
   rad16mmtongue.Checked = False AndAlso rad2.Checked = False AndAlso rad2bytimber.Checked = False AndAlso
   rad3bytimber.Checked = False AndAlso rad5by7.Checked = False AndAlso rad5by8.Checked = False AndAlso
   rad8by10.Checked = False AndAlso rad8by12.Checked = False AndAlso radapex.Checked = False AndAlso
   raddeliveryandinstall.Checked = False AndAlso raddeliveryonly.Checked = False AndAlso radmetal.Checked = False AndAlso
   radnodelivery.Checked = False AndAlso radnone.Checked = False AndAlso radpent.Checked = False Then

        MessageBox.Show("Some items where Not selected ,Click ok To restart", "FORM NOT COMPLETED ", MessageBoxButtons.OK)
        lstdisplay.Items.Clear()
        Application.Restart()

1 个答案:

答案 0 :(得分:0)

要检查两个按钮是否都未选中:

If Not (rad0.Checked AndAlso rad1.Checked) Then
   MessageBox.Show("Write your Error Message")
End If