Changes

Jump to: navigation, search

Visual Basic Flow Control

632 bytes added, 14:59, 8 August 2007
Evaluating Multiple Possibilities using Select Case
== Evaluating Multiple Possibilities using Select Case ==
 
The Visual Basic ''Select Case'' construct is extremely useful if you need to evaluate a value or expression against multiple possible outcomes. For example you might want to compare a string against a variety of other strings in order to decide what action to take. The syntax for the ''Select Case'' construct is as follows:
 
'''Select Case''' ''expression''<br>
&nbsp;&nbsp;'''Case''' ''value1, value2, ...''<br>
&nbsp;&nbsp;&nbsp;&nbsp;...<br>
&nbsp;&nbsp;'''Case''' ''value3, value3, ...''<br>
&nbsp;&nbsp;&nbsp;&nbsp;...<br>
&nbsp;&nbsp;'''Case''' ''value1, value2, ...''<br>
&nbsp;&nbsp;&nbsp;&nbsp;...<br>
'''End Select'''

Navigation menu