Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0 End Sub 上面的只是禁止输入字母。数字和特殊符号都可以输入的我想加多禁止输入数字和特殊符号.应该点写?
语发错误哦!
[CODE]Private Sub Text1_KeyPress(KeyAscii As Integer)Dim s As Strings = "?,./:'"">~!@#$%^&*()_-+|\<>?,./:';{}[]"If InStr(1, s, Chr(KeyAscii)) > 0 ThenKeyAscii = 0BeepEnd IfEnd Sub[/CODE]
烦死不就是一些单引号.双引号吗.自己改改不成.Private Sub Text1_KeyPress(KeyAscii As Integer) Dim s As String s = "?,./:>~!@#$%^&*()_-+|\<>?,./:;{}[]" If InStr(1, s, Chr(KeyAscii)) > 0 Then KeyAscii = 0 Beep End IfEnd Sub