I want to write a function for my subclassed form object. The function must close the form and return a control that was on that form, so I can put it on another form.
I’m having trouble preventing the control from disposing. I thought that removing it from the controls collection using this.Controls.Remove(someControl) would be enough to stop it from disposing, but it still disposes!
What else do I have to do to tell the form not to dispose my control?
Previously, I added the control to the other form before my original form closed. This seemed to stop the dispose. The code to do this is more cumbersome though, and I’d really like to simplify things by closing the original form before I add the control to the other form.
Thanks!
Set the Parent property of the child control to null before disposing of the Parent object.