Timer without form

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

I am writing a windows service and don't want a form or any other UI element
in it. How can I implement timer in this case to run a piece of code every
hour?

Thanks

Regards
 
Hi

I am writing a windows service and don't want a form or any other UI element
in it. How can I implement timer in this case to run a piece of code every
hour?

Thanks

Regards

In a windows service, you'll want to use System.Timers.Timer or
System.Threading.Timer...
 
Don't use a timer, sleep the thread.

System.Threading.Thread.CurrentThread.Sleep(New TimeSpan(1, 0, 0))

Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top