Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Maximum Time using timer object!! 2

Status
Not open for further replies.

Fori

Programmer
Jun 18, 2003
84
MT
Hi again,

do you have any idea what's the maximum time the timer interval property can handle!!? does it support more than a minute!

Tahnks
Nick
 
65,535 milliseconds or just over 1 minute.

Experience is something you don't get until just after you need it.
 
i need at least five minutes how can i go about it?

Thanks
 
Use a counter in the Timer event. For instance:

Code:
Private MyVar as Integer

Private Sub tmrMyTimer_Timer()

MyVar = MyVar + 1

If MyVar = 5 then
  (whatever code you want to execute every 5 minutes)
  MyVar = 0
End If

End Sub

Now, with the interval set to 60000 ms (1 minute), the timer event is called every minute, but it needs to be called 5 times (=5 minutes) before the code executes. You can also go with a smaller interval and a larger value for MyVar; the time it takes for the timer event to be called and the If clause to be evaluated is negligible.



"Much that I bound, I could not free. Much that I freed returned to me."
(Lee Wilson Dodd)
 

But you can use a (static) variable to hold the start time, and execute what you want when the current time > then the time held in the variable.

The interval is: Just an interval. It doesn't need to be used as a Time's-Up function, but can also be used as a "It's time to check the amount of time past" function.
 
Sorry, Sashanan, we must have posted close to the same time.
 
No prob at all, was less than a minute in it. Besides, you tend to explain things better than I do.


"Much that I bound, I could not free. Much that I freed returned to me."
(Lee Wilson Dodd)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top