The form has a property called KeyPreview. You have to set it to true. If that’s not what’s wrong, you have to give us something more to look at...because your code looks fine...
yes, that was it, but that will cause some problems, since I have several selections. I remember that i did this before and i did the arrow1_keydown, and then it would work to have several selections, but if I do that, then it wont work, any reson why?
I'm not sure if I understand your problem, but maybe this helps...Is arrow 1, 2 ,3 and so on controls (buttons, pictures...) then they may have the focus and they will catch the key stroke...if they do maybe you have to write something like:
Private Sub arrow1_KeyDown(KeyCode As Integer, Shift As Integer)
call Form_keyDown
End Sub
Private Sub arrow2_KeyDown(KeyCode As Integer, Shift As Integer)
call Form_keyDown
End Sub
nope, didnt work.
So I'll explain it better: I have 4 Labels, and in front of each one is an arrow, arrow 1, 2, 3, and 4. Only arrow1 is visible, so when i would do:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 40 Then
arrow1.Visible = False
arrow2.Visible = True
End If
End Sub
it would make the second arrow visible, and the first not. But now if i press down again, it should go to the third one, so i would have to do:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 40 Then
arrow1.Visible = False
arrow2.Visible = True
End If
If KeyCode = 40 Then
arrow2.Visible = False
arrow3.Visible = True
End if
End Sub
and that would just skip right down to the third one. But what I remember doing before was:
Private Sub arrow1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 40 Then
arrow1.Visible = False
arrow2.Visible = True
End If
End Sub
Private Sub arrow2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 40 Then
arrow1.Visible = False
arrow2.Visible = True
End If
End Sub
and that worked. I would also stick a keycode 13 in there.
well, I used your code to do the menu, and it is working well, so I started the actual game...Now I like the menu system, so I kept using it. But now I have another problem:
If KeyCode = 39 Then
If Menu = 1 Then
RM.Left - 20
End If
End If
End Sub
RM is the main character
and if menu = 1, it means it is in the game, not in pause or something like that.
But the thing is, when i press the 39 key (right), RM goes all the way to the left of the screen. Why is this?