Home About Contact Privacy Terms Disclaimer
Last Updated On: December 28, 2016
Editor: Adeeb C

Decision Making Using If….Then Statements in VB.Net

Category: Programing,VB.NET

VB.Net supports five types of decision making statements. Among them the simplest one is the If…Then statements. Below are the five types of decision making statements using in VB.Net.

Here we are discussing the decision making in VB.Net using the If Then statements.

The simple if then statement checks whether the condition is true or false, and if the condition is true then the [statement x] will be executed.

Basic Syntax

If condition Then 
 [Statement x]
End If


If (a>0) Then
End If

In the given example, if the value of a is greater than 0 statement x will be executed and will provide the output message “Positive”.

The below program will give you more explanation.

Example Program

Module Module1

 Sub Main()
 Dim num As Integer
 Console.WriteLine("Enter a positive number:")
 num = Console.ReadLine()
 If num > 0 Then
 Console.WriteLine("Number is valid")
 End If
 End Sub

End Module