【发布时间】:2017-06-20 13:53:51
【问题描述】:
我正在尝试做一个酒店计费系统,其中用户不能保留未选中的组合框、单选按钮和列表框,我不知道有人可以帮我解决这个问题吗?
-新手
Dim inp As Integer = 0
If RadioButton1.Checked Or RadioButton2.Checked Or RadioButton3.Checked = False Then
inp = 1
End If
If ComboBox1.Text = "" Then
inp = 1
End If
If ListBox1.SelectedIndex() Then
inp = 1
End If
If inp = 1 Then
MessageBox.Show("No selected type of payment" & vbCrLf & "Or" & vbCrLf & "No selected room capacity" & vbCrLf & "Or" & vbCrLf & "No selected room type", "Error")
inp = 0
End If
【问题讨论】:
-
删除
ElseIf。每个条件都应该在自己的If中 -
您有任何错误吗?第 1 行的逻辑对我来说没有任何意义。
-
顺便说一句,单选按钮通常在设计时设置,以便默认选中其中一个。
标签: vb.net if-statement variable-assignment messagebox