-
January 29th, 2011, 11:27 PM
#1
Swapping control into a different parent
Colleagues,
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.
Code:
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.”
}
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?
Any suggestion, insight or reference is really appreciated!
- Nick
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|