|
-
Jun 2nd, 2002, 07:16 AM
#1
Thread Starter
Member
Arrow Key's
im using this code here:
Private Sub form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 37 Then
picArrow.Move picArrow.Left - 50
End If
If KeyCode = 39 Then
picArrow.Move picArrow.Left + 50
End If
If KeyCode = 40 Then
picArrow.Move picArrow.Left, picArrow.Top + 50
End If
If KeyCode = 38 Then
picArrow.Move picArrow.Left, picArrow.Top - 50
End If
End Sub
and my picturbox (picArrow) doesnt move at all, ive tryed many different kinds of codes, all i want it to do is move the picArrow, help!
-
Jun 2nd, 2002, 07:18 AM
#2
Frenzied Member
I am sure it should work like that too some way, but using the getkeystate API will be better anyways so take a look into that...
Sanity is a full time job
Puh das war harter Stoff!
-
Jun 2nd, 2002, 09:20 AM
#3
Member
if you have a command button or something else that can get 'focus' then it wont work.
if your page is free of command buttons etc and only consists of the form, and your pic then i have no idea.
-
Jun 2nd, 2002, 10:04 AM
#4
Thread Starter
Member
this isnt making any sense, i put this code into a new project:
Dim keycode As String
Private Sub form_KeyDown(keycode As Integer, Shift As Integer)
If keycode = 37 Then
MsgBox "you pressed left"
End If
End Sub
and it works perfectly, but when i put it into the project where i want it to be, it doesnt work.
btw, whats the keycode number for enter, escape, and space bar? (where can i get a full list?)
oh and another thing, when i compile the new project which sais "You pressed left" when you press left, and i send it to my friend, he gets the messege when he presses down...
-
Jun 2nd, 2002, 10:12 AM
#5
Thread Starter
Member
oh, woops, i made a mistake in that post, that
Dim KeyCode as String
isnt suposed to be there.
everythign works as long as there isnt anything in the form.
-
Jun 2nd, 2002, 11:16 AM
#6
Thread Starter
Member
never mind, i got everything to work perfectly. Thansk for the help.
-
Jun 2nd, 2002, 12:17 PM
#7
Frenzied Member
alright...
by the way for you code
you can post it between code or vbcode tags which will make it much more readable.
Sanity is a full time job
Puh das war harter Stoff!
-
Jun 2nd, 2002, 01:00 PM
#8
Thread Starter
Member
oh right, i dont know how to do that.
-
Jun 2nd, 2002, 01:09 PM
#9
Frenzied Member
alright put the word
vbcode in those paranthese []
and to end it /vbcode
Sanity is a full time job
Puh das war harter Stoff!
-
Jun 4th, 2002, 02:38 AM
#10
PowerPoster
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
|