Solved

# moving a picture

Posted on 2003-03-25
Medium Priority
163 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
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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 Month10 days, 16 hours left to enroll