Private Sub Command1_Click()
Dim ch As String
ch = Chr(Int(Rnd * 200) + 1)
Print ch;
If Asc(ch) >= Asc("A") And Asc(ch) <= Asc("Z") Then
MsgBox "这是一个大写字母", , "提示"
ElseIf Asc(ch) >= Asc("a") And Asc(ch) <= Asc("z") Then
MsgBox "这是一个小写字母", , "提示"
ElseIf Asc(ch) >= Asc("0") And Asc(ch) <= Asc("9") Then
MsgBox "这是一个数字", , "提示"
Else
MsgBox "非字母或数字", , "提示"
End If
End Sub
用ascii,码判断很简单嘛
Private Sub Form_Load()
Dim ch As String * 1
ch = "a"
If ((Asc(ch) >= 65 And Asc(ch) <= 90) Or (Asc(ch) >= 97 And Asc(ch) <= 122)) Then
MsgBox "字母"
ElseIf Asc(ch) >= 48 And Asc(ch) <= 57 Then
MsgBox "数字"
Else
MsgBox "其它字符"
End If
End Sub