|
-
Apr 23rd, 2003, 09:23 AM
#1
Thread Starter
Junior Member
With vbKey gone... how do you handle keystrokes?
I was just wondering... in VB6, there is a way to handle keystrokes, and it used the vbKey constants. How do you do this kind of thing in VB.Net?
-
Apr 23rd, 2003, 09:31 AM
#2
Fanatic Member
In the keypress event code for a given control, you'll have something like:
Code:
Select Case e.KeyChar
Case "+", Microsoft.VisualBasic.ChrW(Keys.Enter)
'Some logic
e.Handled = True
Case "-"
'Some other logic
e.Handled = True
End Select
-
Apr 23rd, 2003, 10:19 AM
#3
Thread Starter
Junior Member
Yay, it worked! Thanks for the help!
One thing though; it didn't work for the main form's KeyPress event... why is that?
-
Apr 23rd, 2003, 11:25 AM
#4
Lively Member
Originally posted by 347Studboy
One thing though; it didn't work for the main form's KeyPress event... why is that?
Might be because the keypress was handled by the control with focus rather than the main form itself.
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
|