我寫了一個VB.NET Windows服務,它工作正常。我只有一個問題。我希望服務在半小時和小時標記的頂部執行(例如,9:00,9:30,10:10,10:30,11 :,等等)。我使用下面的代碼:VB.NET計時器問題
Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set things
' in motion so your service can do its work.
Dim oCallBack As New TimerCallback(AddressOf TimedEvent)
oTimer = New System.Threading.Timer(oCallBack, Nothing, 300000, 300000)
EventLog.WriteEntry("CCFinalizeService has begun successfully." , _
System.Diagnostics.EventLogEntryType.Information)
End Sub
此代碼的工作,但是,如果服務的,比如說,10點15分開始,然後執行10:15,10:45,11:15,11: 45。我如何製作它,因此它總是在30分鐘和小時標記的頂部執行?
知道它必須是這樣簡單的事情。謝謝! – Icemanind 2009-05-06 17:52:13