|
-
June 19th, 2001, 09:26 AM
#1
constrain user keyboard?
how can i constrain the user keyb to only letters and numbers
thnks
-
June 19th, 2001, 10:54 AM
#2
Re: constrain user keyboard?
Paste this code in your Keypress event
[vbocde]
Private Sub Text1_KeyPress(KeyAscii As Integer)
KeyAscii = OnlyRealText(Keyassic)
End Sub
Public Function OnlyRealText(Key As Integer) As Integer
Select Case Key
Case 48 To 57 'Numeric
OnlyRealText = Key
Case 65 To 90 'UpperCase Letters
OnlyRealText = Key
Case 97 To 122 'LowerCase Letters
OnlyRealText = Key
Case 8, 13 'Backspace and Enter
OnlyRealText = Key
Case Else
Key = 0
End Function
[/vbcode]
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
|