Click to See Complete Forum and Search --> : Limiting the information entered into a text box
Gimpster
Nov 8th, 1999, 03:43 AM
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
corneslen@hotmail.com
ICQ# 47799046
Aaron Young
Nov 8th, 1999, 03:45 AM
Try this:
Private Sub Text1_KeyPress(KeyAscii As Integer)
If Not IsNumeric(Chr(KeyAscii)) And KeyAscii <> vbKeyBack Then KeyAscii = 0
End Sub
------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net
Gimpster
Nov 8th, 1999, 03:48 AM
Yup, that does it! Thanks.
------------------
Ryan
corneslen@hotmail.com
ICQ# 47799046
Juan Carlos Rey
Nov 8th, 1999, 10:04 AM
You can also use a Masked Edit Box with its Mask property set to "########" , up to the number of digits you want.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.