I have a problem with a timer continuing to fire it's tick event after my form has closed. Not only that, but everytime I reopen the form, I get a new timer instance, with a new event, which eventually results in the application becoming unuseable.
I have tried disabling the timer in the FormClosing event, and even disposing the timer object, as well as removing its event handle, but still cannot stop it.
My form is a simple log viewer that runs as a child control within a master form container. It is written in C# and is only requiring a timer event to refresh the form automatically. My form closing code looks like this:
private void LogViewer_FormClosing(object sender, FormClosingEventArgs e)
{
this.tmRefresh.Stop( );
this.tmRefresh.Tick -= new System.EventHandler(this.tmRefresh_Tick);
this.tmRefresh.Dispose( );
this.Visible = false;
}
but it does not stop the timer tick event firing!
Does anyonehave any suggestions?