Making decisions with select case, Visual Basic Programming

Assignment Help:

The Select Case structure provides an option to If...Then...Else If for selectively executing one block of statements from amongst multiple blocks of statements. Any Select Case statement gives capability similar to the If...Then...Else statement, however it makes code more efficient & readable.

A Select Case structure works along with a single test expression that is evaluated once, at the top of the structure. Then the result of the expression is compared with the values for each Case in the structure. If there is match, block of statements linked with that Case is executed:

Select Case Document.Form1.CardType.Options(SelectedIndex).Text

Case "MasterCard" Display MC Logo Validate MCA count

Case "Visa" Display Visa Logo Validate Visa Account

Case "American Express"

Display AMEXCO Logo

Validate AMEXCO Account

Case Else Display Unknown Image Prompt Again

End Select

Notice that the Select Case structure evaluates an expression once at the top of the structure. On the contrary, the If...Then...ElseIf structure can evaluate a distinct expression for each Else If statement. You can replace an If...Then...Else If structure along with a Select Case structure only if each Else If statement evaluates the same expression.


Related Discussions:- Making decisions with select case

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

HOW TO SOLVE ORDINARY DIFFERENTIAL EQUETION IN VISUAL BASIC PROGRAMMING

Tab order - dialog, Tab Order: The tab order stands for the order in w...

Tab Order: The tab order stands for the order in which the controls receive focus when the user clicks the tab key. The CTRL + D can be used to set the tab order of controls.

Device context - visual c++, DEVICE CONTEXT The device context provides...

DEVICE CONTEXT The device context provides the essential drawing tools and the platform to draw. It helps to draw the text, shapes, lines etc. To create the device context, the

Record set - database applications, Record Set: The record set present...

Record Set: The record set presents the records in a base table or the records retrieved due to the query. The record set falls into 3 classes. These are table type record set

Gdi objects, GDI OBJECTS   The CDC provides 5 versions for the GDI obj...

GDI OBJECTS   The CDC provides 5 versions for the GDI objects. They are fonts, brushes, pens, bitmaps and regions. The Select Object function substitutes the current GDI objec

Using procedure and exception handling, I was looking solution for assignme...

I was looking solution for assignment named Alamo Tour

Check whether a number is palindrome or not, Function IsPalindrome(str) ...

Function IsPalindrome(str) Dim iStart,iEnd,ctr,blnPalin str=trim(str) blnPalin=true iEnd=len(str) iCnt=round(iEnd / 2) iStart=1 for ctr=1 to cint(iCnt) if(mid(str,iEnd,

Events - intrinsic contol, Events: The Controls are placed on a form a...

Events: The Controls are placed on a form and then to make them functional an "event procedure" is related with the control object. An event process is what happens in respons

Modeless dialog, MODELESS DIALOG The Dialog boxes are either modal or m...

MODELESS DIALOG The Dialog boxes are either modal or modeless. The modal dialog box should be closed (Unloaded or hidden) before you can continue the working with the rest of t

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