Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleMake a timer wait a long time between events
Keywordstimer, long timer, wait
CategoriesControls
 
Store the next event time in a variable. Use a timer to check periodically to see if the time has arrived.
 
Private Sub tmrTrigger_Timer()
    ' See if it time for the event.
    If Timer >= NextEventTime Then
        ' Process the event.
        lblEventTime.Caption = Format$(DateAdd("s", _
            INTERVAL_SECONDS, Time))

        ' Set the new event time.
        NextEventTime = NextEventTime + INTERVAL_SECONDS
    End If

    ' Set the timer's interval.
    If NextEventTime - Timer < 60 Then
        tmrTrigger.Interval = (NextEventTime - Timer) * 1000
    Else
        tmrTrigger.Interval = 60000
    End If
End Sub
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated