VB6 Switch和Choose的用法

来源:互联网 发布:巨浪金融研究所数据 编辑:程序博客网 时间:2024/06/06 12:59
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
0 0