Hi
When opening a window, I register a Deleted-event-handler on my business object. It is passed to the constructor as business
:
business.Deleted += new EventHandler<EventArgs>(business_Deleted);
Now the user can click a button to delete it (removing the record, you know). The event handler is registered to capture deletion by other editor windows and notifying the user ("Item has been deleted in another editor window.").
If the user deletes it in the current window, this message would be stupid, so I'd like to unregister the event before:
Business business = (Business)businessBindingSource.DataSource;
business.Deleted -= new EventHandler<EventArgs>(business_Deleted);
My problem is simple: The message is displayed anyway, so unregistering does not work. I tried storing the EventHandler in a separate member. Does not work either.
Any help would be cool.
Matthias
P.S. Reading this post, I'm afraid that properly unregistering the event could make it unregistered for all editor windows. Could be the next problem. ;-)