If Then Else:
The control statement If Then Else is used for computing a condition and taking the action based on the condition. If the condition is true then the section will execute or else block will execute.
If .. Then...Else:
If condition Then
Block of VB Statements
To use If then Else construct you can place a button and the text box on the form as given in the figure. Now Run the project and enter the value in the text box and then click the button. The event handler given below executes and if the value entered surpasses 50 it displays passes, or else it displays fail.
Private Sub Command1_Click()
If Val(Text1.Text) > 50 Then
Figure: Illustration of If then Else