一句代码,实现在文本框中仅能键入数字和字母组成的字符串

Private Sub Text1_KeyPress(KeyAscii As Integer)
If Not (Chr(KeyAscii) Like "[a-zA-Z0-9]" Or KeyAscii < 32) Then KeyAscii = 0
End Sub 

你可能感兴趣的:(integer)