473,320 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Timer without form

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
Nov 20 '05 #1
3 2197
Use the Timer object from the toolbox's components group.

"John" <jo**@nospam.infovis.co.uk> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
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

Nov 20 '05 #2
On Thu, 15 Jul 2004 01:24:20 +0100, John wrote:
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...

--
Tom Shelton [MVP]
Nov 20 '05 #3
Bob
Don't use a timer, sleep the thread.

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

Bob

"John" <jo**@nospam.infovis.co.uk> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
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


Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ken Kast | last post by:
I have the following app logic: 1. A form frmMain shows another modeless form. The second form is stored in a private variable ScrnTip in frmMain. A system timer is set to close the form. 2....
7
by: Grahmmer | last post by:
I have a few timers that are added to a form at runtime. I can handle the event fine, but I cannot identify which timer fired. Is there a way to do this? Timer Creation: -------------...
4
by: Dan | last post by:
Hi, I have a timer on a form (System.Windows.Forms.Timer - Framework 1.1) that is set to 60 seconds as sort an of inactivity monitor. If 60 seconds have elapsed without any user activity I want...
10
by: Bob | last post by:
Okay, I've done this for years but now I'm going to question it just because this idea has been at the back of my head since I started using DotNet... My WinForms app queries a database every 60...
5
by: muzilli | last post by:
Howdy all, I would like to know how can I insert a Timer object in my class library? This timer object will start and stop in a determinated part or event of my program. I know how to do...
12
by: Gina_Marano | last post by:
I have created an array of timers (1-n). At first I just created windows form timers but I read that system timers are better for background work. The timers will just be monitoring different...
4
by: Bails | last post by:
Hi Im an absolute beginner in programming and am using VB.Net Express. To start my larning I decided to do a "Real World" app instead of "hello world" and am creating a Poker Countdown clock. ...
10
by: Phil | last post by:
I'm glad to see that in VB 2005 I no longer have to create a form if I want a timer like I did in VB6. I notice though, that there seems to be a Timer component as well as two different timer...
8
by: Jerry Spence1 | last post by:
Do Timers operate on the UI thread, or do they have it's own thread? I'm trying to assess the pros and cons for using a timer or a thread for a certain application. -Jerry
4
by: =?iso-8859-1?B?S2VyZW0gR/xtcvxrY/w=?= | last post by:
Hi, i have a main thread an another worker thread. The main Thread creates another thread and waits for the threads signal to continue the main thread. Everything works inside a ModalDialog and...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.