|
-
Jun 17th, 2005, 04:35 PM
#1
Thread Starter
Fanatic Member
Using Form_KeyDown?
I'm trying to make the arrow keys usable in a game I am writing in VB.NET
Here's a snippet of my code:
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.Right Then
yy = yy - 1
drawit()
....
I can't get this to work, when I push the 'right' arrow key, the focus cycles between the form objects, moving from button to button, instead of executing this command here. How do I do this?
-
Jun 17th, 2005, 05:00 PM
#2
-
Jun 17th, 2005, 06:39 PM
#3
Thread Starter
Fanatic Member
Re: Using Form_KeyDown?
I tried this, it didn't change anything.
-
Jun 17th, 2005, 06:45 PM
#4
Fanatic Member
Re: Using Form_KeyDown?
Try putting e.Handled = True in there
-
Jun 17th, 2005, 07:08 PM
#5
Thread Starter
Fanatic Member
Re: Using Form_KeyDown?
That didn't work either. The focus just keeps jumping around the buttons when I push the arrow keys.
-
Jun 17th, 2005, 07:09 PM
#6
Thread Starter
Fanatic Member
Re: Using Form_KeyDown?
Odd - it worked when I changed it to Keys.S, instead of the Arrow keys.
I'll go with WASD. Thanks.
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
|