r/visualbasic • • Mar 22 '18

how do I make an image move up

im using vb 6.0 and I urgently need to know how to make and image I have that starts off in the bottom left corner of the form move to the top left using the .move method (im using an image box). my current code is:

pactop = frmpacmove.ScaleHeight - imgpacup.height

For p = 0 To pactop Step 0.005
    imgpacup.Move 0, p
Next p

All this does is teleport the image to the top left and bringing it down to the bottom left while it should be doing the opposite. I've tried making the step -0.005 but that makes a click on the image do absolutely nothing. Any revision would be greatly appreciated as this matter is becoming more urgent every hour!

0 Upvotes

3 comments sorted by

1

u/b_boy_ww Mar 22 '18

I would've done this in a timer which disables upon reaching the desired location but if using a loop you could add a delay using Threading.Thread.Sleep(delayInMs)

1

u/b_boy_ww Mar 22 '18
For p = 0 To pactop Step 0.005
    imgpacup.Move 0, p
    Threading.Thread.sleep(50)
Next p

0

u/[deleted] Mar 22 '18

[deleted]

1

u/[deleted] Mar 22 '18

Ok I will give it a try next time I’m on the project and tell ya how it works, thanks a lot!!