VB if..else


The If...Else selection structure allows the programmer to specify that a different action is to be performed when the condition is True than when the condition is False.

Syntax

If <condition > Then
    statements
Else
    statements
End If

Example

If average > 50 Then
     txtGrade.Text = "Pass"
Else
     txtGrade.Text = "Fail"
End If

Share this article on