Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Having problems with Timer

Status
Not open for further replies.

radiance

Programmer
Jan 4, 2003
164
US
Hello.

i want to drop in a timer for my windows service file which should run every 3 days. i imported the following namespaces,

Imports System.Threading.Timer
Imports System.Timers

but I am still having problems with the timer. I get an error on System.timers about...etc

I dropped a timer in and then took it out, nothing works.

here's the code (do I need to to put it in a sub...)

dim xy as new timeSpan(3,0,0)
system.timers.timer g = new system.timers.timer(xy.milliseconds)
AddHandler g.Elapsed, AddressOf TimerElapsed
g.enabled=true

thanks in advance.
 
3 days in milliseconds would be what... 26 million or so? Check the parameter on the timer constructor, it may be Integer (maxes out at 16 million).

If so, you may want to have the timer run more often, and check a stored value of the last time the process was run. If it has been more than 3 days from the last run, run the procedure again. If not, do nothing.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
if it maxes out, are there other options? I get a syntax error and I need the service to run weekly, but in intervals.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top