is it possible to move more then one image at once in visual basic 6?

25 pts.
Tags:
Visual Basic
Visual Basic 6
Visual Basic Programming
hey i have a question concrening to visual basic 6,

in visual basic i am trying to move an animation with the arrow keys, and i can not get it to move at all, i belive i got the right code but i am not sure, here is the sample of the code

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)     tmrMove.Enabled = True     If KeyCode = 37 Then         imgMove0.Left = imgMove0.Left - 150         imgMove1.Left = imgMove0.Left - 150         imgMove2.Left = imgMove2.Left - 150         imgMove3.Left = imgMove3.Left - 150         imgMove4.Left = imgMove4.Left - 150         imgMove5.Left = imgMove5.Left - 150         imgMove6.Left = imgMove6.Left - 150         imgMove7.Left = imgMove7.Left - 150         imgMove8.Left = imgMove8.Left - 150     ElseIf KeyCode = 39 Then         imgMove0.Left = imgMove0.Left + 150         imgMove1.Left = imgMove0.Left + 150         imgMove2.Left = imgMove2.Left + 150         imgMove3.Left = imgMove3.Left + 150         imgMove4.Left = imgMove4.Left + 150         imgMove5.Left = imgMove5.Left + 150         imgMove6.Left = imgMove6.Left + 150         imgMove7.Left = imgMove7.Left + 150         imgMove8.Left = imgMove8.Left + 150     End If End Sub

if this is the right code, what then do i need to change?

 

please help me as soon as possible



Software/Hardware used:
Visual Basic 6

Answer Wiki

Thanks. We'll let you know when a new response is added.

This is just a guess, while you answer the below question.

In your form you might have a control that automatically gets the focus, and that control is receiving the KeyDown event (not the form).

If that is the case, try setting the “KeyPreview ” property of the form to <i>’true’</i>, so it can receive these events before any control, and handle them.

Discuss This Question: 5  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • carlosdl
    What kind of object/component are tmrMove and imgMove<n> ?
    70,190 pointsBadges:
    report
  • 0savage0ed0
    tmrMove is a timer, and imgMove0-8 are images that were a part of an animation. the timer was suposed to change the images position. so it would be a walking animation.
    25 pointsBadges:
    report
  • carlosdl
    So, did the 'KeyPreview' suggestion help ?
    70,190 pointsBadges:
    report
  • 0savage0ed0
    yes the key preview did help, i also added the images to a picture box that helped, thank you.
    25 pointsBadges:
    report
  • JennyMack
    Hi 0savage0ed0, Thanks for giving feedback on Carlosdl's answer! Jenny Community Manager
    4,280 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following