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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timer that starts a certain time

Status
Not open for further replies.

MatsHulten

Programmer
Dec 29, 2000
180
SE
The standard timer control executes an event every x milliseconds.
I need a control that executes in the same way, but uses the clock. For instance I would like to be able to start an event every day at 13.00

I can't use the sheduling functions in the OS as the program needs a certain amount of input at at startup, that can't be passed by parameters, or read from a file.

Any hints?
-Mats
 
I've been able to design a few simple events that run off of a timer. This simple example could provide the hint for a more complex solution. Simply add a timer control off of your toolbox on the form. In the timer properties make sure the enabled property is True and you have set an interval. I set the timer in code to a particular time then I call a Msg box with a reminder message when the time is reached. I use this for a reminder service! Of course the program must be running for it to work. I don't know yet how to run timers if the program isn't running.

Private Sub Timer1_Timer()
If Time = #8:08:00 AM# Then
MsgBox "This is a reminder you have a meeting in 10 minutes"
End If

End Sub

 
Hmmm... For this to work I need to set the timer interval to no more than one minute, to be sure that I catch the If-statement.

I was hoping there was a simple timer control that operates directly on the system clock, using a time, not an interval, to trigger the event.

The example you have given matches what I'm looking for, but I was hoping for a bit more elegant solution. (No offence!)

Sincerely
-Mats
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top