Hallo everyone,
I am using vs 2005 with vb.net. I want to run a windows service once a day automatically. I used the threading timer and it runs perfect for the first and does not run automatically everyday. i kept the timedelay 360000 * 24 so that after the service first time start it will calculate 1 day time.. here is the code
Private Timer1 As System.Threadin g.Timer
Private Const Timedelay As Long = 3600000 * 24
Protected Overrides Sub OnStart(ByVal args() As String)
Dim Timerdelegate As TimerCallback = AddressOf Timer1_Tick
Dim AutoEvent As New AutoResetEvent( False)
Timer1 = New Timer(Timerdele gate, AutoEvent, 0, Timedelay)
'EventLog.Write Entry("Simple Service")
End Sub
In the timer tick the change the timedelay
Private Sub Timer1_Tick(ByV al stateinfo As Object)
// here is the code that run when the service start
Call Timer1.Change(T imedelay, Timedelay)
End Sub
is this correct or any changes ?..
thank you..
Dinesh.
I am using vs 2005 with vb.net. I want to run a windows service once a day automatically. I used the threading timer and it runs perfect for the first and does not run automatically everyday. i kept the timedelay 360000 * 24 so that after the service first time start it will calculate 1 day time.. here is the code
Private Timer1 As System.Threadin g.Timer
Private Const Timedelay As Long = 3600000 * 24
Protected Overrides Sub OnStart(ByVal args() As String)
Dim Timerdelegate As TimerCallback = AddressOf Timer1_Tick
Dim AutoEvent As New AutoResetEvent( False)
Timer1 = New Timer(Timerdele gate, AutoEvent, 0, Timedelay)
'EventLog.Write Entry("Simple Service")
End Sub
In the timer tick the change the timedelay
Private Sub Timer1_Tick(ByV al stateinfo As Object)
// here is the code that run when the service start
Call Timer1.Change(T imedelay, Timedelay)
End Sub
is this correct or any changes ?..
thank you..
Dinesh.
Comment