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
What kind of object/component are tmrMove and imgMove<n> ?
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.
So, did the ‘KeyPreview’ suggestion help ?
yes the key preview did help, i also added the images to a picture box that helped, thank you.
Hi 0savage0ed0,
Thanks for giving feedback on Carlosdl’s answer!
Jenny
Community Manager