Longer timer interval. 
Author Message
 Longer timer interval.

I want to set the timer's interval to 1 or 2 hours, but the maximum interval
value is a approximately minute.
Can I somehow set the interval to such high value?


Mon, 29 Dec 2003 18:13:41 GMT  
 Longer timer interval.
Tal,

You can set the time interval to maximum value it allows and in the Timer
event procedure check current time to time saved in a module level variable:

Private m_TimeStarted as Date

Private Sub Form_Load()
  m_TimeStarted = Now
End Sub

Private Sub Timer1_Timer()
  If DateDiff("h", m_TimeStarted, Now) =1 Then
        MsgBox "Hour passed."
        m_TimeStarted = Now
  End If
End Sub

--
HTH,
Alexander Shirshov, MCSD


Quote:
> I want to set the timer's interval to 1 or 2 hours, but the maximum
interval
> value is a approximately minute.
> Can I somehow set the interval to such high value?



Mon, 29 Dec 2003 17:22:24 GMT  
 Longer timer interval.
Hi,

One way would be to use the LongTimer.ocx that you can download from my
homepage (source for it is available there).

--
Richard Grier (Microsoft Visual Basic MVP)
Hard & Software
12962 West Louisiana Avenue
Lakewood, CO  80228
303-986-2179 (voice)
303-986-3143 (fax)
Author of Visual Basic Programmer's Guide to Serial Communications, 2nd
Edition ISBN 1-890422-25-8 (355 pages).
For information look on my homepage at http://www.hardandsoftware.net.
Use the Books link to order.  For faster service contact the publisher at
http://www.mabry.com/vbpgser.



Mon, 29 Dec 2003 22:48:20 GMT  
 Longer timer interval.
Tal,

How about a little arithmetic?

Sub Timer1_Timer

Static isCounter As Integer

isCounter = isCounter + 1
If isCounter >= kLIMIT Then
    isCounter = 0
    Call Timer1_TimerJob ' which does the work
End If

End Sub

Set the timer to run every minute, set "kLIMIT" to the number of minutes
delay you want and put the main code that the Timer performs into
Timer1_TimerJob().

HTH,
    Phill  W.


Quote:
> I want to set the timer's interval to 1 or 2 hours, but the maximum
interval
> value is a approximately minute.
> Can I somehow set the interval to such high value?



Tue, 30 Dec 2003 19:17:37 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Longer timer interval.

2. Longer timer interval.

3. timer with interval longer than 1 minute

4. Timer interval is depending on code in timer event

5. Interval Timer

6. Timer interval in VB.NET

7. Timer Interval

8. Timer interval problems

9. timers, specifying intervals

10. VB5 timer interval

11. Timer.interval

12. Timer.interval ??

 

 
Powered by phpBB® Forum Software