On Tue, 7 Dec 2004 13:53:06 -0600, "Jay B. Harlow [MVP - Outlook]"
¤ Doug,
¤ As Paul stated, you can use either the System.Threading.Timer class or
the
¤ System.Timers.Timer class.
¤
¤
http://msdn.microsoft.com/library/d...ref/html/frlrfsystemtimerstimerclasstopic.asp
¤
¤ The advantage of the Threading.Timer is it has a "due time" parameter on
¤ when the first event should occur.
¤
¤ I've using System.Timers.Timer in my services with success.
¤
¤ The following article in MSDN Magazine explains the difference between
the
¤ three timer objects in .NET & when to use each.
¤
¤
http://msdn.microsoft.com/msdnmag/issues/04/02/TimersinNET/default.aspx
¤
¤ The above article also discusses if & how each timer interacts with
¤ threading.
¤
¤
¤ I would consider using a TimeRange structure to only process events
during
¤ "business hours", possibly reading "business hours" form the app.config
¤ file.
¤
¤ For information on a TimeRange structure that I created see:
¤
http://groups-beta.google.com/group..._doneTitle=Back+to+Search&&d#835f79ef3acde155
¤
¤ Static businessHours As New TimeRange(#8:00:00 AM#, #5:00:00 PM#)
¤
¤ If businessHours.Contains(DateTime.Now) Then
¤ ' process the event
¤ Else
¤ ' skip the event
¤ End If
¤
¤ Hope this helps
¤ Jay
Good info Jay. You just need to be aware of the following bug when using
System.Timers.Timer:
BUG: The Elapsed event of the System.Timers.Timer class is not raised in a
Windows service
http://support.microsoft.com/default.aspx?scid=kb;en-us;842793
Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)