If - else statement, Visual Basic Programming

A variation on the If...Then...Else statement lets you to choose from various alternatives. By adding up Else If clauses expands the functionality of the If...Then...Else statement so that you might control program flow depends on different possibilities. For instance:

Sub ReportValue(value) If value = 0 Then

MsgBox value

ElseIf value = 1 Then

MsgBox value

ElseIf value = 2 then

Msgbox value


Msgbox "Value out of range!" End If

You can add as several ElseIf clauses as you have to provide alternative choices. Extensive use of the ElseIf clauses frequently becomes cumbersome. A better way to select between numerous alternatives is the Select Case statement.

Posted Date: 4/18/2013 5:41:05 AM | Location : United States

Related Discussions:- If - else statement, Assignment Help, Ask Question on If - else statement, Get Answer, Expert's Help, If - else statement Discussions

Write discussion on If - else statement
Your posts are moderated
Related Questions

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

ODBC   The ODBC gives an API which distinguishes the data base vendors implementation via the ODBC drivers specific to a DBMS. The program will use the API to call the ODBC dr

Data types: The New data types were defined by using the typedef or #define statements. This was to allow the transition from 16 bit to 32 bit system. Some of the fresh data t

Adding Handlers With Class Wizard: Whenever a handler is added, the class wizard places the prototype for the message handler in the header (.H) file. It gives a skeleton hand

You can employ For...Next statements to run a block of statements a specific number of times. For loops, employ a counter variable whose value is increased or decreased with each r

Sets or returns context ID for topic in Help File. If Help file is indicated in the VBScript Err Object HelpFile Property, the HelpContext property is utilized to display automatic

Benefits of Using DLLs: The dynamic linking has the following advantages which are as shown below: It saves memory and decreases the swapping. Many processes can use a s

Assume you are creating an order entry and editing application for a book store. An order consists of a product, quantity, total price, payment type including Credit/Debit card acc

The objective of this unit is to describe the basics of VBScript. After completing this unit, you will be capable to write code for Web pages via VBScript. You will be able to unde