bertino12
asked on
Shorten this conditional Statement
Is there a way to convert this to a shorter condition with OR's? I tried and got flakey results.
If tb.Text = "" Then
If tb.Name = "textbox1" Then
ElseIf tb.Name = "textbox2" Then
ElseIf tb.Name = "textbox3" Then
Else
tb.Text = "0"
End If
bool = False
End If
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What about:
If tb.Text = "" AndAlso (tb.Name = "textbox1" OrElse tb.Name = "textbox3" OrElse tb.Name = "textbox3") Then
tb.Text = "0"
bool = False
End If
Second one should be "textbox2". Sorry :\
If tb.Text = "" Then
SELECT CASE tb.Name
CASE "textbox1"
......
CASE "textbox2"
......
CASE "textbox3"
.......
CASE Else
tb.Text = "0"
END SELECT
bool = False
End If