I want to be able to keep all other information other than numbers from being entered into a text box. How can I do this?
------------------
Ryan
[email protected]
ICQ# 47799046
Printable View
I want to be able to keep all other information other than numbers from being entered into a text box. How can I do this?
------------------
Ryan
[email protected]
ICQ# 47799046
Try this:
Code:Private Sub Text1_KeyPress(KeyAscii As Integer)
If Not IsNumeric(Chr(KeyAscii)) And KeyAscii <> vbKeyBack Then KeyAscii = 0
End Sub
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
Yup, that does it! Thanks.
------------------
Ryan
[email protected]
ICQ# 47799046
You can also use a Masked Edit Box with its Mask property set to "########" , up to the number of digits you want.