Hi,
I have problem with looping in Windows Service.
Here is some sample code:
Protected Overrides Sub OnStart(ByVal args() As String)
AddHandler timer.Elapsed, AddressOf Me.OnElapsedTime
timer.Interval = sValue
timer.Enabled = True
End Sub
Private Sub OnElapsedTime(ByVal source As Object, ByVal e As ElapsedEventArgs)
run_timer()
End Sub
Protected Overrides Sub OnStop()
timer.Enabled = False
End Sub
Public Sub run_timer()
//some declarations
For Each row_loop As DataRow In ds_loop.Tables("loop").Rows
//do something in database
Next
End sub
The problem is that each time when timer is elapsed only first element of the loop is being executed and ithe rest are not executing.
Can any one tell me what is the problem??
Thank You.
I have problem with looping in Windows Service.
Here is some sample code:
Protected Overrides Sub OnStart(ByVal args() As String)
AddHandler timer.Elapsed, AddressOf Me.OnElapsedTime
timer.Interval = sValue
timer.Enabled = True
End Sub
Private Sub OnElapsedTime(ByVal source As Object, ByVal e As ElapsedEventArgs)
run_timer()
End Sub
Protected Overrides Sub OnStop()
timer.Enabled = False
End Sub
Public Sub run_timer()
//some declarations
For Each row_loop As DataRow In ds_loop.Tables("loop").Rows
//do something in database
Next
End sub
The problem is that each time when timer is elapsed only first element of the loop is being executed and ithe rest are not executing.
Can any one tell me what is the problem??
Thank You.