How do I limit textbox only to accept text w/o using maskedcontrol?
Printable View
How do I limit textbox only to accept text w/o using maskedcontrol?
Im not sure what you want.
Please explain.
Do you want only certain
letters to appear that
are typed?
Code:Private Sub Text1_KeyPress(KeyAscii As Integer)
If IsNumeric(Chr(KeyAscii)) Then KeyAscii = 0
End Sub
Code:Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii > 49 And KeyAscii < 57 Then KeyAscii = 0
End Sub
Use this to only accept numbers
Code:Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii < 33 Then Exit Sub
If Not (IsNumeric(Chr(KeyAscii))) Then KeyAscii = 0
End Sub
And this just to tease people ;)
Code:Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii < 33 Then Exit Sub
If KeyAscii Mod 2 = 0 Then KeyAscii = 0
End Sub