Results 1 to 10 of 10

Thread: Arrow Key's

  1. #1

    Thread Starter
    Member insaneman's Avatar
    Join Date
    Oct 2001
    Posts
    63

    Angry 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!

  2. #2
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    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!

  3. #3
    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.
    Maxtech Computing
    Maxtech Computing Forums

    Now try this on your school network kids!
    Code:
    Call Shell("net send * hey goto www.maxtechcomputer.net !", vbHide)

  4. #4

    Thread Starter
    Member insaneman's Avatar
    Join Date
    Oct 2001
    Posts
    63
    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...

  5. #5

    Thread Starter
    Member insaneman's Avatar
    Join Date
    Oct 2001
    Posts
    63
    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.

  6. #6

    Thread Starter
    Member insaneman's Avatar
    Join Date
    Oct 2001
    Posts
    63
    never mind, i got everything to work perfectly. Thansk for the help.

  7. #7
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    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!

  8. #8

    Thread Starter
    Member insaneman's Avatar
    Join Date
    Oct 2001
    Posts
    63
    oh right, i dont know how to do that.

  9. #9
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    alright put the word
    vbcode in those paranthese []
    and to end it /vbcode
    Sanity is a full time job

    Puh das war harter Stoff!

  10. #10
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765
    I just asked the same question in this thread.

    http://www.vbforums.com/showthread.p...hreadid=176022
    Don't Rate my posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width