Safe Handling of Timers
I need to know if there is a safe way to handle timers in a Component.
Specifically, I need to ensure the timer is stopped and destroyed.
If I have a User Control:
Code:
class MyControl : UserControl
{
private Timer timer = new Timer();
public MyControl()
{
...
timer.Start();
...
}
}
Now suppose that user control is placed into a form. I need to ensure that the timer gets stopped if the form containing the control is closed. How can I do that?
Eggman
Using: VS 2008 w. Net 3.5