Basics of VB Programming
The If..Then..Else statement is one used a lot by programmers. It checks if a certain condition is true and then executes a statement. The Else statement is used if the statement does not comply with the criteria. e.g.
Dim i As Integer i=10 If i=10 Then Msgbox "i=10" Else Msgbox "i is not 10" End If
You can also use nested If..Then..Else statements. e.g.
Dim i As Integer i=10 If i=10 Then If i>9 Then Msgbox "i>9" Else Msgbox "i<9" End If Msgbox "i=10" Else Msgbox "i does not = 10" End If
Page 6 of 6