Link to home
Start Free TrialLog in
Avatar of j8907dwyer
j8907dwyer

asked on

moving a picture

I want to slowly move picture upwards vertically. It starts on the form at pic.top = 4000 and I want it to move up a certain distance depending on a variable (A). The variable A is entered on a different form and when this form opens the picture should move.


Private Sub Form_Load()
z = 0
End Sub

Private Sub time_Timer()
Do While z < A
pic.Top = 4000 - z
z = z + 1
Loop


Avatar of Jacamar
Jacamar

dim z as integer

Private Sub Form_Load()
z = 0
End Sub

Private Sub time_Timer()
dim A as integer
A = cint(Form1.Text1.text)
Do While z < A
pic.Top = 4000 - z
z = z + 1
Loop
Avatar of Richie_Simonetti
Private Sub time_Timer()
static i as long
if i=4000 then
   time.enabled=false
else
   pic.Top = 4000 - z
   i = i + 1

end if
end sub

but if value i is in another form you should full reference it and not use static declaration:

Private Sub time_Timer()

if form2.i=4000 then
   time.enabled=false
else
   pic.Top = 4000 - form2.i
   form2.i = form2.i + 1

end if
end sub


' form2
public i as long
Private Sub Form_Load()
   z = 0
End Sub

Private Sub time_Timer()
    if (z < A) then
         time.Enabled = false
         exit sub
    exit sub
    pic.Top = 4000 - z
    z = z + 1
Loop


' I recommend you disabling the time in design time and enabling the time when form activates (because there is a small time lag between form_load and form_activate
Private Sub Form_Activate()
    time.Enabled = true
End Sub

Good Luck!
at design time, hold your left mouse button down on the picture and move the mouse in a slow upward position
Hi

Go to http://www.a1vbcode.com/search.asp

Type "animation" in the search box (Located in top right corner) and click search.

There are plenty of downloads. You might find a nice one over there.

Enjoy!

Cheers

Narayanan
Hi j8907dwyer,
This old question (QID 20562918) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

 -->PAQ - no points refunded

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER

GPrentice00
Cleanup Volunteer
ASKER CERTIFIED SOLUTION
Avatar of YensidMod
YensidMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial