Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
2.00/5 (3 votes)
See more:
hello

how can I let timer work after specific event ?
not work when the form is loaded ...
foe example : after message

thanks
Posted

There are a couple ways you can do this. Either put a timer control on your form or create it in your code. Either way, you can set the Enabled property to false until you want to start it. Then set it to true. Here is a tutorial on how to do so:

http://www.c-sharpcorner.com/UploadFile/mahesh/WorkingwithTimerControlinCSharp11302005054911AM/WorkingwithTimerControlinCSharp.aspx[^]

In your situation, you would start with the timer disabled. Then, after your message pops up (or however it happens), you would enable the timer. After the set amount of time, the timer event would fire.

It is also good to note that the timer has a Start method and a Stop method. These do the same thing as setting the Enabled to true and false respectively.
 
Share this answer
 
v2
Comments
maxpower12345 14-Jun-12 6:48am    
thanks alot ^_^
+5
VJ Reddy 14-Jun-12 13:23pm    
Good answer. 5!
 
Share this answer
 
Comments
maxpower12345 14-Jun-12 12:08pm    
thanks :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900