If testexpression matches any of the case expressionlist expressions
, execute the statement between this case clause and the next one, for the last
clause, the statement is executed between the clause and the end Select, and the control
The statement that is transferred after the end Select. such as testexpression and multiple
The expressionlist expression in the case clause matches, only the first match
The following statement is executed. Case Else is used to indicate that if the testexpression
No match was found between the expressionlist of any other case option, the
Line elsestatements. Although not necessary, it is best to put the case Else language
Sentence is placed in a Select case block to handle unforeseen testexpression values
。 If no case expressionlist matches testexpression and no
Case Else statement, the statement after the end Select continues to execute.
Select case Testexpression [Case expressionlist-n
[Statements-n]] . . . [Case Else Expressionlist-n
[Elsestatements-n]] End Select
<%@ Page language= "VB"%>
<script runat= "Server" >
Sub Page_Load (Sender as Object, E as EventArgs)
Dim strclockstatus As String
Strclockstatus = "AAA"
Select Case Strclockstatus
Case "AAA", "BBB", "CCC"
Response.Write ("A")
Case "DDD"
Response.Write ("B")
Case Else
Response.Write ("C")
End Select
End Sub
</script>
</body>
Example Two
<%@ Page language= "VB"%>
<script runat= "Server" >
Sub Page_Load (Sender as Object, E as EventArgs)
Dim intAge As Integer = 7
Select Case IntAge
Case "7"
Response.Write ("That ' s a string!")
Case 7
Response.Write ("7")
Case <10
Response.Write ("Less than 10")
End Select
End Sub
</script>
</body>