Well, yes, I'm gonna ask a question about the Keypress event. I know it's been beat to death, but I couldnt find my answer with a search so here goes:
I want the right arrow key to activate the Button click event for a button on my form.
I have tried many different things with the Keypress and Keydown events, but I cant figure it out. I am currently using this code in the KeyDown event from a thread I saw. It doesent work though.
VB Code:
If (e.KeyCode = Keys.Right) Then
Call btnRight_Click(sender, e)
Else
e.Handled = False
End If
Can anyvody help?
Last edited by The Phoenix; Sep 1st, 2003 at 02:25 AM.
Take my love
Take my land
Take me where I cannot stand
I don't care, I'm still free
You can't take the sky from me...
I see in your code that it is in the Textbox1 keyDown event. Can you explain that to me? Does that mean that the event will fire only when that textbox has focus? Obviously, I know nothing about this, so any help is greatly appreciated.
Thanks for the code, BTW.
<EDIT>
Well, I tried the code. I didnt have a textbox on my form, so I put one there. I added your code to the textbox1.keydown event. (I hade to change the e.Keycode.Right to e.Keycode = Keys.Right)
It doesent work. When I press the Right Arrow, it starts cycleing through all my controls.
I apologize if I'm being dense here. As I said, I don't know much about this kind of thing.
Last edited by The Phoenix; Aug 31st, 2003 at 02:54 PM.
Take my love
Take my land
Take me where I cannot stand
I don't care, I'm still free
You can't take the sky from me...
OK . The best bet now is API . It works well . I've got a demo for making hotkeys but it uses ALT+Letter or any else combinations . You wanna have a look ?
Well . I've tried this but if there is a button getting the focus , the form keydown event will not fire . I've trid this before , something like visibling the form if a key is pressed and if the other key is pressed it's shown . I couldn't do this using many ways .I had to use API . That's my point when I mentioned API .
Originally posted by Pirate Well . I've tried this but if there is a button getting the focus , the form keydown event will not fire . I've trid this before , something like visibling the form if a key is pressed and if the other key is pressed it's shown . I couldn't do this using many ways .I had to use API . That's my point when I mentioned API .