timer in VB

0 pts.
Tags:
Visual Basic
Hi, If i want to perform a task operation in a system for every one hour. What object should i use? I try to use Timer, but it only can set the time interval to 65000 miliseconds (max. 1 minute only), if more than 1 minutes it comes out error. So what if i want to set it to one hour? Pls help! Thanks
ASKED: April 10, 2005  5:03 AM
UPDATED: April 10, 2005  1:03 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

Whenever you need notifications of periods longer than supported directly, go ahead and use a standard VB Timer control. Set its Interval property to the greatest common denominator of your various needs. In this case, your need is 60 minutes, so you could use a one-minute interval (60,000).

Use a static counter within the Timer event to keep track of how many notifications have passed. When you reach the magic multiple, fire off the code that needs to run. For example, say you need to perform a given task every five minutes. I like to set the timer’s Interval property to a value no more than half the resolution I’m seeking. In a case like this, I’d probably want an event every 30 seconds or so. The code within the Timer event keeps track of how many times the event has fired, so it can determine when to execute the periodic code:

Hope this helps. There are other ways but this is simple. Alternative simple route is to fire the application every hour via Scheduled Tasks, if this fits your environment and the applications role.

Best wishes..

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following