Siebel VB Language Reference > Siebel VB Language Reference >

Select Case Statement


This standard VB control structure executes one or more statements, depending on the value of an expression.

Syntax

Select Case testexpression

     Case expressionList

          [statement_block]

     [Case expressionList

          [statement_block] ]

     .
     .

     [Case Else

          [statement_block]

End Select

Placeholder
Description
testexpression
Any expression containing a variable to test
expressionList
One or more expressions that contain a possible value for testexpression
statement_block
One or more lines of code to execute if testexpression equals a value in expressionList

Returns

Not applicable

Usage

When there is a match between testexpression and one of the values in expressionList, the statement_block following the Case clause is executed. When the next Case clause is reached, execution control goes to the statement following the End Select statement.

The expressionList(s) can be a comma-separated list of expressions of the following forms:

expression

expression To expression

Is comparison_operator expression

The type of each expression must be compatible with the type of testexpression.

Each statement_block can contain any number of statements on any number of lines.

NOTE:  When the To keyword is used to specify a range of values, the smaller value must appear first. The comparison_operator used with the Is keyword is one of the following: <, >, = , < = , > = , <> . You must also use the Is operator when the Case is one end of a range, for example, Case Is < 100.

See Also

If...Then...Else Statement
On...GoTo Statement
Option Compare Statement


 Siebel VB Language Reference
 Published: 18 June 2003