如果声明或其他

时间:2018-04-17 12:25:43

标签: vb.net visual-studio visual-studio-2012

您好我正在使用此代码

If ComboBox1.SelectedItem = "X (Recommended)" OrElse
   Not ComboBox1.SelectedItem = "B (Recommended)" OrElse
   Not ComboBox1.SelectedItem = "Shift" OrElse
   Not ComboBox1.SelectedItem = "SpaceBar" OrElse
   Not ComboBox2.SelectedItem = "G (Gun Slote 1)" OrElse
   Not ComboBox2.SelectedItem = "G (Gun Slote 2)" OrElse
   Not ComboBox2.SelectedItem = "G (Gun Slote 3)" OrElse
   Not ComboBox3.SelectedItem = "LAlt (Recommended)" OrElse
   Not ComboBox4.SelectedItem = "LAlt (Recommended)" OrElse
   Not ComboBox5.SelectedItem = "RButton (Wepon Slote 1)" OrElse
   Not ComboBox5.SelectedItem = "RButton (Wepon Slote 2)" OrElse
   Not ComboBox5.SelectedItem = "RButton (Wepon Slote 3)" OrElse
   Not ComboBox6.SelectedItem = "E (Right to Left)" OrElse
   Not ComboBox6.SelectedItem = "E (Left to Right)" OrElse
   Not ComboBox7.SelectedItem = "H (Recommended)" OrElse
   Not ComboBox8.SelectedItem = "T (Cs1,Sword2)" OrElse
   Not ComboBox8.SelectedItem = "T (Cs2,Sword1)" OrElse
   Not ComboBox8.SelectedItem = "T (Cs3,Sword2)" OrElse
   Not ComboBox9.SelectedItem = "N (Recommended)" OrElse
   Not ComboBox10.SelectedItem = "Z (Wepon Slot 1)" OrElse
   Not ComboBox10.SelectedItem = "Z (Wepon Slot 2)" OrElse
   Not ComboBox10.SelectedItem = "Z (Wepon Slot 3)" OrElse
   Not ComboBox11.SelectedItem = "C (Slote 1)" OrElse
   Not ComboBox11.SelectedItem = "C (Slote 2)" OrElse
   Not ComboBox11.SelectedItem = "C (Slote 3)" OrElse
   Not ComboBox12.SelectedItem = "Q (Slote 1)" OrElse
   Not ComboBox12.SelectedItem = "Q (Slote 2)" OrElse
   Not ComboBox12.SelectedItem = "Q (Slote 3)" OrElse
   Not ComboBox13.SelectedItem = "Every 5 Min" OrElse
   Not ComboBox13.SelectedItem = "Every 10 Min" OrElse
   Not ComboBox13.SelectedItem = "Every 20 Min" OrElse
   Not ComboBox13.SelectedItem = "Every 30 Min" OrElse
   Not ComboBox14.SelectedItem = "Every 5 Sec" OrElse
   Not ComboBox14.SelectedItem = "Every 10 Sec" OrElse
   Not ComboBox14.SelectedItem = "Every 15 Sec" OrElse
   Not ComboBox15.SelectedItem = "F" Then

    If ComboBox1.SelectedItem = "" Then

    Else
        ComboBox1.Enabled = False
    End If

    If ComboBox2.SelectedItem = "" Then

    Else
        ComboBox2.Enabled = False
    End If

    If ComboBox3.SelectedItem = "" Then

    Else
        ComboBox3.Enabled = False
    End If

    If ComboBox4.SelectedItem = "" Then

    Else
        ComboBox4.Enabled = False
    End If

    If ComboBox5.SelectedItem = "" Then

    Else
        ComboBox5.Enabled = False
    End If

    If ComboBox6.SelectedItem = "" Then

    Else
        ComboBox6.Enabled = False
    End If

    If ComboBox7.SelectedItem = "" Then

    Else
        ComboBox7.Enabled = False
    End If

    If ComboBox8.SelectedItem = "" Then

    Else
        ComboBox8.Enabled = False
    End If

    If ComboBox9.SelectedItem = "" Then

    Else
        ComboBox9.Enabled = False
    End If

    If ComboBox10.SelectedItem = "" Then

    Else
        ComboBox10.Enabled = False
    End If

    If ComboBox11.SelectedItem = "" Then

    Else
        ComboBox11.Enabled = False
    End If

    If ComboBox12.SelectedItem = "" Then

    Else
        ComboBox12.Enabled = False
    End If

    If ComboBox13.SelectedItem = "" Then

    Else
        ComboBox13.Enabled = False
    End If

    If ComboBox14.SelectedItem = "" Then

    Else
        ComboBox14.Enabled = False
    End If

    If ComboBox15.SelectedItem = "" Then

    Else
        ComboBox15.Enabled = False
    End If
Else

End If

此处我有15个ComboBox,因此,如果我点击并检查ComboBox中的此值,则会停用所有ComboBox es,

例如,如果我选择" B(推荐)"在ComboBox1

然后这将禁用所有ComboBox

= - = - = -

  

它只适用于我选择" X(推荐)"从第一个ComboBox1

开始

- = -

我尝试了orElse,最后是OrElse Not

直到现在还没有很好的结果。

1 个答案:

答案 0 :(得分:0)

你只能使用 - " OrElse"而不是OrElse NOT