If then else - control statement, Visual Basic Programming

Assignment Help:

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

Else

Block of VB Statements

End If

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

Form1.Print "pass"

Else

Form1.Print "fail"

End If

End Sub

2370_if then else.png

Figure: Illustration of If then Else


Related Discussions:- If then else - control statement

Attributes, departmental store attributes

departmental store attributes

Variable scope, Variables must always be described with the smallest scope ...

Variables must always be described with the smallest scope possible. VBScript variables can have the given scope. Scope Where Variable is Declared

Cell phone application, to dial a person''s 10 digit number and assign it t...

to dial a person''s 10 digit number and assign it to their name

MATHEMATICS PROJECT, HOW TO SOLVE ORDINARY DIFFERENTIAL EQUETION IN VISUAL ...

HOW TO SOLVE ORDINARY DIFFERENTIAL EQUETION IN VISUAL BASIC PROGRAMMING

What is the method of creating a new project in vb.sss, Visual Basic 1....

Visual Basic 1. What is the method of creating a new project in VB.SSS 2. Illustrate Code Editor Window and Solution Explorer. 3. Write a VB program to sort and display a

Match Game, I would like someone to look at my code and tell me why it''s n...

I would like someone to look at my code and tell me why it''s not working

Balancesheet, i need sample balance sheet form in vb.net

i need sample balance sheet form in vb.net

Features of user interface design, FEATURES OF USER INTERFACE DESIGN Th...

FEATURES OF USER INTERFACE DESIGN The features like how will the software's are used? Who will be the users? What will be the life of the software? During its lifetime how ofte

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd