Library articles and tutorials
Select Case statement
By James Crowley, published on 14 Jul 2001
Page 2 of 3
- Introduction
- Syntax
- Usage
Syntax
The Select Case statement uses the following syntax:
Select Case testexpression
Case expressionlist1
statements
Case expressionlist2
statements
Case Else
statements
End Select
testexpression is a single expression, that is evaluated at the top of the list. The expressionlist then lists possible conditions and if the testexpression is equal to this case, the code in that section is run.
Related articles
Related discussion
-
ditto
by zapthedingbat (2 replies)
-
Mousewheel
by jonh (3 replies)
-
True multithread VB source code controls
by James Crowley (3 replies)
-
Rely
by Yujvendra Verma (4 replies)
-
True multithread VB source code controls
by James Crowley (3 replies)
You want Case "SomeString", "NoString".
This below code segment throws casting exception
Select Case str1
Case "SomeString" Or "NoString"
Response.Write("OK")
Case "SmallString" And "BigString"
Response.Write("AND here")
End Select
Can you please explain the structure of Case statement in detail ?
Thanx in Adv.
If you put the Case Is statement first, will it run this message box and not look at the others?