Let's say I have a WinForm with a System.Windows.Forms.Timer running in it.
In the Tick event of the timer I update the form.
Now, must I, in a Form_Closing handler, do something like the following?
timer.Enabled = false;
Application.DoEvents(); // process any pending messages before the
// form closes
Cool Guy - 29 Aug 2005 19:14 GMT
> Let's say I have a WinForm with a System.Windows.Forms.Timer running in it.
> In the Tick event of the timer I update the form.
[quoted text clipped - 4 lines]
> Application.DoEvents(); // process any pending messages before the
> // form closes
Having now had the chance to look at the code in Reflector, I think the
answer is: no.
It appears that when System.Windows.Forms.Timer.Dispose is called, the
actual Win32 timer is first killed and then all timer-related messages are
taken from the message queue and processed.