Solved

# moving a picture

Posted on 2003-03-25
Medium Priority
164 Views
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.

z = 0
End Sub

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

0
Question by:j8907dwyer

LVL 2

Expert Comment

ID: 8206068
dim z as integer

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
0

LVL 16

Expert Comment

ID: 8206082
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
0

LVL 11

Expert Comment

ID: 8206846
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!
0

Expert Comment

ID: 8207279
at design time, hold your left mouse button down on the picture and move the mouse in a slow upward position
0

LVL 3

Expert Comment

ID: 8218768
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
0

Expert Comment

ID: 8531619
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.
0

LVL 6

Expert Comment

ID: 9441063
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

GPrentice00
Cleanup Volunteer
0

Accepted Solution

YensidMod earned 0 total points
ID: 9495715
This question is PAQed and no points refunded (of 70)

YensidMod
Expert Exchange Moderator
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
###### Suggested Courses
Course of the Month9 days, 23 hours left to enroll