|
-
Nov 6th, 2009, 06:34 AM
#7
Addicted Member
Re: Cant figure out how to use keys, any ideas?
 Originally Posted by ozirock
Sorry about the mix up with the forums guys.
Thanks for your help gonzalioz, I can get your code to work in a file on its own but when I try to integrate it to my original code, it has no effect, I'm wondering if the code I wrote to connect to the interface board is causing problems for my other code even though it's telling me there are no errors, could that be the case?
Or is the fact that I placed buttons on my form a factor? Is there a setting I missed related to this?
Also I didnt know about the KeyPreview property so thanks for that
Thanks,
Oisin
Remove your old key-event handlers if you still have them. If you have a duplicate procedure with different parameters you won't get an error, but only one of them will be called. If you have focus on control other than your form, handling MyBase.KeyDown() won't help you, but you'll have to handle that controls events instead. I recommend overriding the keydown event if you need to focus on other controls, like this:
Code:
Protected Overrides Sub OnKeyDown(ByVal e As System.Windows.Forms.KeyEventArgs)
MsgBox(e.KeyCode)
MyBase.OnKeyDown(e)
End Sub
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
|