|
-
Nov 4th, 2009, 05:09 AM
#1
Thread Starter
Lively Member
How to use system.threading.timer
I have used system.timers.timer to watch several folders and move files in my windows service. But the timer event stops now and then. I have read that it is better to use system.threading.timer in services.
This is my system.timers.timer code:
Private Timer As New System.Timers.Timer
AddHandler Timer.Elapsed, New System.Timers.ElapsedEventHandler(AddressOf Me.Timer_Elapsed)
Timer.Interval = 4000
Timer.Start()
Private Sub Timer_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs)
' do my code here!
End Sub
How do this code look like in system.threading.timer?
How do i start and stop the timer using threading? That is very important because i stop the timer when it comes to the elapsed event and when the code har run it starts the timer again!
/Patrik
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|