G
Guest
I have several bound controls which attach delegates to a data source. I have
code in the control's Dispose override to remove the delgates.
I'm finding that when the form is closed, the control's Dispose method is
not getting called and the delegate is not getting detached. I tried
overriding the form's Dispose method, and calling Dispose on each control,
but it's not getting called either.
If I call form.Dispose on exit from ShowDialog, I get an
ObjectDisposedException on the the Controls collection.
My question is twofold: 1) is Dispose the correct place to remove delgates?
And 2) where would be the best/safest place to put my call to form.Dispose?
code in the control's Dispose override to remove the delgates.
I'm finding that when the form is closed, the control's Dispose method is
not getting called and the delegate is not getting detached. I tried
overriding the form's Dispose method, and calling Dispose on each control,
but it's not getting called either.
If I call form.Dispose on exit from ShowDialog, I get an
ObjectDisposedException on the the Controls collection.
My question is twofold: 1) is Dispose the correct place to remove delgates?
And 2) where would be the best/safest place to put my call to form.Dispose?