·  VB – Syntax – Conditional Statements – If...Then...Else

 

- Info:

  - This tutorial shows how to use If...Then...Else conditional statements.

  - You will get Syntax error if you don't go to new line after keyword Then.

 

- Procedure:

  - Create VB Application Test.vb

 

    Test.vb

    Sub Main()

    

      value = 101

      text  = "bird"

      

      If value = 10 Then

        MsgBox ("Value = 10")

      ElseIf text = "bird" Then

        MsgBox ("text equals bird")

      Else

        MsgBox ("No match found")

      End If

    

    End Sub