Private Sub Text1_KeyPress(KeyAscii As Integer)If KeyAscii >= 48 And KeyAscii <= 57 Then MsgBox "数字"If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Then MsgBox "字母"End Sub