vb应用程序中如何屏蔽用户输入的全角字符

来源:百度知道 编辑:UC知道 时间:2024/05/19 14:06:15
所有的全角字符,数字全要屏蔽。代码最好详细一些。

这个能将所有输入的全角转换成半角
Private Sub Text1_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(StrConv(Chr(KeyAscii), 8))
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If Not ((KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122)) Then
KeyAscii = 0
End If
End Sub