When is a good moment to attach to ParentForm.Closed event? I want to be
notified when the form is closing, because I want to kill a worker
thread in my control. But, I don't know when the ParentForm property has
a valid value: if I put my control in a tab, ParentForm is null in OnLoad.

Signature
Boris Drajer <boris.drajer@do.not.s.p.a.m.micro-bs.com>
Nathan Ernst - 07 Apr 2005 16:05 GMT
Register for your control/form's ParentChanged event, then do it there. That
ought to be the first chance you have to know who your parent is.
-Nathan
> When is a good moment to attach to ParentForm.Closed event? I want to be
> notified when the form is closing, because I want to kill a worker
> thread in my control. But, I don't know when the ParentForm property has
> a valid value: if I put my control in a tab, ParentForm is null in OnLoad.