View Single Post
  #2 (permalink)  
Old 05-01-2008, 03:20 PM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: London, England
Posts: 5,030
Last Blog:
Web slideshow in JavaS...
Rep Power: 43
Xav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to behold
Send a message via MSN to Xav
Default Re: using timer to elapse time before method?

The Timer does not work in this way. What you do is set the timer's Interval property to 4000 (specified in milliseconds):

Code:
System.Timers.Timer timer2 = new System.Timers.Timer();
			timer2.Elapsed += new System.Timers.ElapsedEventHandler(timer2_Tick);
timer2.Interval = 4000;
			timer2.Start();
Then, when the four seconds is up, the timer automatically calls the timer2_tick() event. Therefore, you don't need any of the code in that method - it calls it automatically after 4 seconds.

Xav
__________________
[TRUTH] TcM is the best moderator ever! [/TRUTH]
"Valid XHTML is like sex - everybody claims to have the same goal, but everybody has their own tricks and results vary wildly."
Web Site | Beta Site
Reply With Quote