471,347 Members | 1,701 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,347 software developers and data experts.

I need help with this service problem

Hi,
I have created a service that runs fine when set to check every fre secs,
however, I set it to run every 2 hours but when I start the service it runs
only once.

This is how I am setting the 2 hours

Dim TimerItem As New System.Threading.Timer(TimerDelegate, 1, _
10000, 3600000)

Any ideas?

Thanks
Jul 21 '05 #1
2 1078
Are you sure you are restarting the timer once you have finsihed what you
need to do in the Timer1_Tick event? Have you assigned a method to this event?

HTH

Graham Harris

"Chris" wrote:
Hi,
I have created a service that runs fine when set to check every fre secs,
however, I set it to run every 2 hours but when I start the service it runs
only once.

This is how I am setting the 2 hours

Dim TimerItem As New System.Threading.Timer(TimerDelegate, 1, _
10000, 3600000)

Any ideas?

Thanks

Jul 21 '05 #2
This is a sample of what I am doing

On service startup I have

Dim TimerDelegate As New Threading.TimerCallback(AddressOf ExecuteTask)

Dim TimerItem As New System.Threading.Timer(TimerDelegate, 1, _
10000, 3600000)


Protected Sub ExecuteTask(ByVal obj As Object)

If (GetFileByFtp()) = True Then

ProcessFile(sFileName)

Kill("C:\" & sFileName)

Else

Exit Sub

End If

End Sub

Thats basically what I have.

"bmsgharr" wrote:
Are you sure you are restarting the timer once you have finsihed what you
need to do in the Timer1_Tick event? Have you assigned a method to this event?

HTH

Graham Harris

"Chris" wrote:
Hi,
I have created a service that runs fine when set to check every fre secs,
however, I set it to run every 2 hours but when I start the service it runs
only once.

This is how I am setting the 2 hours

Dim TimerItem As New System.Threading.Timer(TimerDelegate, 1, _
10000, 3600000)

Any ideas?

Thanks

Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Julia | last post: by
11 posts views Thread by dcinfinite | last post: by
1 post views Thread by Camilla | last post: by
2 posts views Thread by Owe Armandt | last post: by
5 posts views Thread by hourlie | last post: by
reply views Thread by Ronak mishra | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.