if 语句或 else

if statement or else

你好,我正在编写这段代码

If ComboBox1.SelectedItem = "X " 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 中的这个值,将禁用所有 ComboBoxes,

例如,如果我在ComboBox1中选择"B (Recommended)",

那么这将禁用所有 ComboBox,

=-=-=-

it only works when I choose "X (Recommended)" from first ComboBox1

-=-

我尝试了 orElse ,最后 OrElse Not

直到现在都没有好的结果。

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