Siebel VB Language Reference > VB Language Reference >

Select Case Statement

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


Select Case testexpression
   Case expressionList
   [Case expressionList
      [statement_block] ]
   [Case Else
End Select



Any expression containing a variable to test


One or more expressions that contain a possible value for testexpression


One or more lines of code to execute if testexpression equals a value in expressionList


Not applicable


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 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