|
-
August 24th, 1999, 08:51 PM
#1
Textbox help
Is there a way to limit what can be typed into a textbox? For instance, only numbers or letters?
--
Screaming Fist
A witty saying proves nothing.
-
August 24th, 1999, 10:48 PM
#2
Re: Textbox help
Hi,
Yes, we can limit the characters in a textbox. Here is an example which limit the characters to Hexadecimal value:
private Sub Text1_KeyPress(KeyAscii as Integer)
Dim strValid as string
strValid = "0123456789ABCDEF" 'valid input
KeyAscii = Asc(UCase(Chr(KeyAscii))) 'force uppercase
If KeyAscii > 26 then 'if not control code
If InStr(strValid, Chr(KeyAscii)) = 0 then
KeyAscii = 0
End If
End If
End Sub
Enjoy yourself and good luck to you.
Gary Ng
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|