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

Constant naming conventions, Earlier versions of VBScript had no mechanism ...

Earlier versions of VBScript had no mechanism for making user-defined constants. Constants, if utilized, were implemented as variables & distinguished from other variables by using

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

i need sample balance sheet form in vb.net

The view - document view architecture, The View: The view is used for ...

The View: The view is used for visualising. For illustration, while performing word processing, the user works on a sequence of words which compose the text. If a user is perf

Error handling in vbscript, While a run-time error takes place, the propert...

While a run-time error takes place, the properties of the Err object are filled with information which uniquely identifies the error & information which can be used to handle it. I

Variable length strings, Variable Length Strings: The Strings can be de...

Variable Length Strings: The Strings can be declared using As or $ as shown in the code below; the msg and msg1 are the two strings and they are assigned the values using '='.

Naming restrictions, For naming anything variable names follow the standard...

For naming anything variable names follow the standard rules in VBScript. A variable name: Should begin with an alphabetic character. Cannot have an embedded period. Sh

Document view architecture, DOCUMENT VIEW ARCHITECTURE The Document/Vie...

DOCUMENT VIEW ARCHITECTURE The Document/View architecture is used to build an application based on the Microsoft Foundation Classes library. The Document/View architecture is s

Windows 32 bit (win 32) applications, WINDOWS 32 BIT (WIN 32) APPLICATIONS ...

WINDOWS 32 BIT (WIN 32) APPLICATIONS   The Win 32 based applications are the applications developed for the windows family of the operating systems. The Win 32 applications ac

Mfc classes, THE MFC CLASSES The CDocument, CWinAppCFrameWnd and CView ...

THE MFC CLASSES The CDocument, CWinAppCFrameWnd and CView are derived from the CObject and they give the majority of the structure and functionality.

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