D
Doug Perkes
Background
--------------------------
I am in the process of creating a WinForms app with many forms.
I have a set of forms that all subscribe to events on a custom object.
When the forms are created I manually create a subscription in the
form to one or more events in the custom object. (BTW, this is the
same design pattern used by IssueVision discussed at DevDays).
I have a controller form (MDI parent) that determines which child form
is currently being viewed. When a new child form is selected, the
current child form is manually closed [using Form.Close()] and
disposed [using Form.Dispose()] and then the new form is shown. This
keeps only one child form open at a time.
Question
--------------------------
Even after child forms are closed and disposed, when events are raised
from the custom object, the events are still triggered in the disposed
child forms.
Could someone explain why this is happenning? I must be
misunderstanding something. Do the child forms need to manually
unsubscribe from the events in the Closing event? Is there a better
place to do this?
TIA,
Doug
--------------------------
I am in the process of creating a WinForms app with many forms.
I have a set of forms that all subscribe to events on a custom object.
When the forms are created I manually create a subscription in the
form to one or more events in the custom object. (BTW, this is the
same design pattern used by IssueVision discussed at DevDays).
I have a controller form (MDI parent) that determines which child form
is currently being viewed. When a new child form is selected, the
current child form is manually closed [using Form.Close()] and
disposed [using Form.Dispose()] and then the new form is shown. This
keeps only one child form open at a time.
Question
--------------------------
Even after child forms are closed and disposed, when events are raised
from the custom object, the events are still triggered in the disposed
child forms.
Could someone explain why this is happenning? I must be
misunderstanding something. Do the child forms need to manually
unsubscribe from the events in the Closing event? Is there a better
place to do this?
TIA,
Doug