26 Jun '15

Anupa Manipal

A professional Software Developer in VB.NET - SQL Server and learner of PHP. Expertise in implementation of various projects including designing, development, coding and implementation of software applications.

0 Shares

If Then Else Statement in VB.NET

If Then Else Statement in VB.NET

If Then Else Statement in VB.NET used to check the condition true or false. This logical operator is used to compare the data using comparison operator. If the condition is true then true statement will execute, if the condition is false then the false statement will execute. In this program user can check conditions by entering number 1 and number 2. The button will check the condition each and every time whenever user clicks submit button.


Syntax:
This is the syntax of if then else statement in vb.net:

In the syntax, If the condition is true true block will execute and if the condition is false else block will execute.


Source Code and screen shot: 

In the screenshot number 1 entered 100 and number 2 entered 50. After checking the condition it checks and displays “Number 1 is greater than number 2”.

If Then Else Statement

This is the source code. In the btnchkcondition button click event if else condition created. If the condition true then it will execute the true statement. If the condition is false then it will execute the false statement. True statement is between if and else block and false statement is between else and end if block.


Download Source Code: This source code works well in visual studio 2012.

free student projects


Video Tutorial: This video tutorial explains how to write this if then else statement and it shows how the code is compiled, executed and its result.

Thanks for reading this article. If you have any queries kindly post in the comment box.

About Anupa Manipal

A professional Software Developer in VB.NET - SQL Server and learner of PHP. Expertise in implementation of various projects including designing, development, coding and implementation of software applications.

Related Posts

Leave a Reply