Option Explicit
Private Sub Command1_Click()
'VB的Switch语句
Dim strKey As String
Dim strGetValue As String
strKey = "2"
strGetValue = Switch(strKey = "1", "a", strKey = "2", "b")
MsgBox strGetValue '得到 b
End Sub
Private Sub Command2_Click()
'VB的Choose语句
Dim strKey As String
Dim strGetValue As String
strKey = "3"
strGetValue = Choose(strKey, "a", "b", "c")
MsgBox strGetValue '得到c
End Sub
Private Sub Command1_Click()
'VB的Switch语句
Dim strKey As String
Dim strGetValue As String
strKey = "2"
strGetValue = Switch(strKey = "1", "a", strKey = "2", "b")
MsgBox strGetValue '得到 b
End Sub
Private Sub Command2_Click()
'VB的Choose语句
Dim strKey As String
Dim strGetValue As String
strKey = "3"
strGetValue = Choose(strKey, "a", "b", "c")
MsgBox strGetValue '得到c
End Sub