|
-
Dec 15th, 2007, 12:45 PM
#1
Thread Starter
Addicted Member
[RESOLVED] [2008] Validating input data
how can I stop the input of the keyboard for a user
I want that everytime the user press a key the program read what key was and only accept some keys that I want
-
Dec 15th, 2007, 04:29 PM
#2
Frenzied Member
Re: [2008] Validating input data
vb.net Code:
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles TextBox1.KeyDown
If Not e.KeyCode = Keys.A Then 'A is an accepted key
e.Handled = True
End If
End Sub
that should work
-
Dec 15th, 2007, 06:26 PM
#3
Thread Starter
Addicted Member
Re: [2008] Validating input data
It didn't work but I found a solution
Code:
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If Not e.KeyCode = Keys.A Then 'A is an accepted key
e.SuppressKeyPress = True
End If
End Sub
-
Dec 15th, 2007, 06:28 PM
#4
Frenzied Member
Re: [RESOLVED] [2008] Validating input data
That was what I meant:P
Glad you found it
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
|