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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting Timer interval

Status
Not open for further replies.

kokon

Programmer
Apr 27, 2006
31
0
0
PL
I have problem with setting timer interval propably because of the type conversion. Please see my code below.
--------------------------------------
Code:
TimeSpan HourNow = CurrTime.TimeOfDay;
TimeSpan HourScheduled = new TimeSpan (1,readint,RandomStartMin, 0);
TimeSpan Duration = HourScheduled - HourNow;
timer1.Interval = Convert.ToInt32(Duration.TotalMilliseconds);
timer1.Tick += new EventHandler(DayTicker);
timer1.Start();
--------------------------------------
Firs time start is ok, but it is lunching DayTicker() 6 to 10 times in 1 minute, despite interval is set to = 1000000
Please help
 
When i put there
timer1.Interval = 10000

it works all right
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top