January 29th, 2011, 11:27 PM
Swapping control into a different parent
What I'm trying to achieve is kind of an undocking behavior, where a control can undock from one form and float in a different form. My code is based on a working reference design. Unfortunately, I ran into a problem. I’m getting an exception when I try to assign a different parent form to the control.
The same exception happens if I call this.Controlls.Add(m_ctrlContainer). It looks like the parent is in a state where controls can’t be added to it. What can I do to add controls to it?
private void FloatPanel()
// this method resides in the new parent form for the control to float in
// m_ctrlContainer control, which will be swapped into a floating form
m_ctrlContainer.Parent = this; // throws exception “Collection is read only.”
Any suggestion, insight or reference is really appreciated!
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.