vb6 timer object

The interval in this object is the number of milliseconds between when the object completes it's procedure and when it fires again, correct?  In other words, if the interval is set at 1000 and the procedure takes 2.5 seconds to complete then the next time the object fires will be 3.5 seconds after the first, correct?
Bob SchneiderCo-OwnerAsked:
Who is Participating?
 
Martin LissOlder than dirtCommented:
VB6 can only do 1 thing at a time so the executions of the timer will not overlap.
0
 
Martin LissOlder than dirtCommented:
1000 millisecond is 1 second, so if the Interval is set to 1000 the procedure will fire every second.
0
 
dsackerContract ERP Admin/ConsultantCommented:
If the interval is set at 1000 and the procedure takes 2.5 seconds to complete then the next time the object fires will be 3.5 seconds after the first, correct?
Incorrect. The interval is 1000 milliseconds, regardless, meaning they could overlap.

The best practice is for the first lines in your handler to immediately turn off the timer, and if you wish to repeat, then at the end of your handler, turn the timer back on.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Bob SchneiderCo-OwnerAuthor Commented:
good info.  Thank you.
0
 
Martin LissOlder than dirtCommented:
To demonstrate set the Interval to 1000 and run this code.

Private Sub Timer1_Timer()
Static times
Debug.Print "Start: " & Now

Dim x
Dim y
Dim z

For x = 1 To 10000
For y = 1 To 10000
z = z
Next
Next

Debug.Print "End: " & Now
times = times + 1
If times = 5 Then Timer1.Enabled = False

End Sub

Open in new window

0
 
Bob SchneiderCo-OwnerAuthor Commented:
Good to know...sorry I already assigned points...can I re-open it?
0
 
Martin LissOlder than dirtCommented:
I don't see that you've done that, but you can Request Attention and ask a moderator to help you do that.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.