RockGuitarist1 RockGuitarist1 - 1 year ago 55 Question

Adding another condition to this conditional if statement

I have this if statement right here:

If lbl1.Text <> "Good" Or lbl2.Text <> "Good" Or lbl3.Text <> "Good" Then
Exit Sub
End If

This works fine, but I also need to attach another condition to it, but for some reason I am drawing a blank on it. I need it to also pass that it is ok for lbl2 & lbl3 to be an empty string. In order words, if lbl1.text = "Good" then it is ok for lbl2 & lbl3 to be empty, therefore it will not exit sub.

Answer Source

What about a statement like this?

If Not ((lblA.Text = "Good" OrElse lblA.Text = String.Empty) AndAlso _
            (lblB.Text = "Good" OrElse lblB.Text = String.Empty) AndAlso _
            (lblC.Text = "Good" OrElse lblC.Text = String.Empty)) Then
    End If
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download