We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Changing the parent property of control at design time

Thread ID:

Created:

Platform:

Replies:

29882 Jun 6,2005 07:43 AM Windows Forms 0
loading
Tags: FAQ
arunkumar
Asked On June 6, 2005 07:43 AM

Hi I am trying to change the parent property of the control that was dragged and dropped in a control container. While doing this i get the error message "The operation is not valid due to current state of the object". I dont know why this error arises. Please look at the code below for MyControl designer: public class SingleViewControlDesigner : ControlDesigner { private Control myControl; public override void Initialize(IComponent component) { base.Initialize (component); myControl = (Control) component; Control target = myControl.Parent.Parent; myControl.Parent = target; target.Controls.Add(myControl); } } Please help me to solve this problem. Thanks in advance, Arun M

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;