25 pts.
 is it possible to move more then one image at once in visual basic 6?
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
ASKED: January 7, 2010  9:30 PM
UPDATED: January 11, 2010  5:11 PM

Answer Wiki:
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.
Last Wiki Answer Submitted:  January 7, 2010  11:35 pm  by  carlosdl   63,535 pts.
All Answer Wiki Contributors:  carlosdl   63,535 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

What kind of object/component are tmrMove and imgMove<n> ?

 63,535 pts.

 

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 pts.

 

So, did the ‘KeyPreview’ suggestion help ?

 63,535 pts.

 

yes the key preview did help, i also added the images to a picture box that helped, thank you.

 25 pts.

 

Hi 0savage0ed0,

Thanks for giving feedback on Carlosdl’s answer!

Jenny
Community Manager

 4,265 pts.