C
craig
Assume that you have two forms, Form A and Form B.
Code in Form A instantiates and maintains a reference to Form B. Form B
contains an event handler for one of the buttons on Form A. This event
handler is "wired up" when form B is instantiated, in the Form_Load event.
When code in Form A eventually releases its reference to Form B, form B
needs to remove its event handler from Form A. What would be the best way
to make this happen? I could do this by making Form A call a public method
on Form B that releases the event handler. But is there a more automatic
way of making this happen?
Thanks!
Code in Form A instantiates and maintains a reference to Form B. Form B
contains an event handler for one of the buttons on Form A. This event
handler is "wired up" when form B is instantiated, in the Form_Load event.
When code in Form A eventually releases its reference to Form B, form B
needs to remove its event handler from Form A. What would be the best way
to make this happen? I could do this by making Form A call a public method
on Form B that releases the event handler. But is there a more automatic
way of making this happen?
Thanks!