Posted on 2008-11-01
I use some custom controls on my CF2 Form I add dynamic and need to remove dynamic from my Form.
The matter is that I get an ObjectDisposedException when I dispose it at some of it's events.
So in the constructor I apply some events to the parent form eg.:
this.Parent.MouseUp += new MouseEventHandler(Parent_MouseUp);
When I dispose it I remove these events:
protected override void Dispose(bool disposing)
this.Parent.MouseUp -= Parent_MouseUp;
However this don't solve the problem.
What works for me is to catch the ObjectDisposedException but I think this is not the cleanest way to make it working ...
Maybe somebody know a better solution?