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

What is meant by dtd?, Question 1 Design a form based applications using l...

Question 1 Design a form based applications using labels, text boxes, and buttons to perform basic arithmetic operations on integers Question 2 Describe the concept of Except

Message routing - visual basic, Message Routing: The system posts the ...

Message Routing: The system posts the messages to a first-in, first-out queue known as the message queue or it sends the messages directly to a window procedure. The Messages

To calculate rectangle, two sides are given of a sheet e.g 23*36 i want hal...

two sides are given of a sheet e.g 23*36 i want half or 1/2 of this sheet next i want 1/4(one fourth) of this sheet if sheet size is 23*36 next i want 1/8 similary as above

Program to draw a rectangle shape , Create a project that draw a rectangle ...

Create a project that draw a rectangle shape which may be either (*) or (+) according to the selected radio button. The number of rows in the shape will be taken from the 1 st

Adding events in visual basic , Adding Events in VB   For adding the e...

Adding Events in VB   For adding the events in VB, first double click on the command button with the caption hello. The Private Sub command1_Click () and End Sub would be

Visual Basic 2010 by Julia Case Bradley and Anita C. Millspa, - I have the ...

- I have the chapter 5 project completed already. This is due tomorrow. Modify the Very Very .Boards project from Chapter 5 to separate the user interface from the business logic.

Create a visual basic application to play Hangman game, Create a Visual Bas...

Create a Visual Basic that allows a user to play a variation of Hangman. User Inputs The user types a letter into the textbox.   Functional Items 1. Read a

Mdi application - types of project using visual c++, MDI Application: ...

MDI Application: The MDI application utilizes the main frame window as the work space in which the user can open more document frame windows.

Data control, DATA CONTROL The data control is used to connect to the d...

DATA CONTROL The data control is used to connect to the database. Three properties are very necessary to connect to the database. The primary property is the database name. You

Coding, Write an event procedure to automate the billing system of a superm...

Write an event procedure to automate the billing system of a supermarket. Give the details of database tables, forms, controls and menu design (if any). Make assumptions, wherever

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