在select case 语句中可以使用关系运算符大于>小于<等于=等关系运算符,需要用关键字IS和TO。用个例子来说明:
Private Sub Command1_Click()
Dim age As Integer
age = Text1.Text
Select Case age
Case Is < 14(如果age小于14时)
Label1.Caption = "小朋友,你好!"
Case 14 To 23(如果age在14到23时)
Label1.Caption = "学生朋友,认真读书吧。"
Case 24 (如果age是24时)
Label1.Caption = "你和我是同龄人"
Case Is > 100 (如果age大于100时)
Label1.Caption = "你真是个老不死!"
Case Else (如果age不满足以上所有值的范围时)
Label1.Caption = "按道理我要尊重你。"
End Select
End Sub