Windows Develop Bookmark and Share   
 index > Windows Forms Designer > 2005 RTM: A circular control reference has been made. A control cannot be owned by or parented to itself.
 

2005 RTM: A circular control reference has been made. A control cannot be owned by or parented to itself.

Well, dang.

I had re-done a form that was causing me other problems with the designer. All seemed fine, I went home, and returned to the form this morning to find this:

A circular control reference has been made. A control cannot be owned by or parented to itself.

This form has a few split containers on it. This instability is very frustrating. Anyone else ever see this?

dma550  Tuesday, January 17, 2006 2:17 PM

I am seeing the same problem... I have a mock Outlook style UI with nested split containers, etc. It worked fine in the designer and I can build it however when I execute it I get a nasty popup saying there is a serious issue and that it has to be shutdown. So I exited VS 2005 and came back in this morning and reloaded from source server and now the designer is complaining of a circular reference....

CAC90  Wednesday, January 25, 2006 3:31 PM
It's a Designer bug.  I think the problem occurs when you put one SplitContainer inside another and then start going around renaming the SplitContainers.

Double-click the related warning in the errors list, and it will bring you into the line in the *.Designer.vb file that's causing the problem.  It will look something like this:

Me.SplitContainer1.Panel2.Controls.Add(Me.SplitContainer1)

Change it so that the parent isn't the same name as the inner split container.  i.e. something like:

Me.splitMain.Panel2.Controls.Add(Me.SplitContainer1)

You may have to do similar massaging in other places in the file, but you should be able to restore your form.

-Richard
Richardk  Thursday, February 23, 2006 3:39 PM
If you are confident that this is a designer bug, see if you can create a sample project and/or instructions to reproduce the problem, then log a bug report at http://lab.msdn.microsoft.com/productfeedback/.
CommonGenius.com  Thursday, February 23, 2006 6:32 PM
Will do that if I get some time. If anyone else beats me to it, my thanks to them in advance.

One very positive thing I have to say about Microsoft is they seem to be making customer feedback a top priority.
Richardk  Thursday, February 23, 2006 11:38 PM
I am using VC++ 2005 getting the same problem when the designer wrote wrong things in code and I changed them manually. Program works fine (as far as I can see), but designer still gives me the error.
siavoshkc  Saturday, September 09, 2006 10:30 PM

Has anyone found a solution to this problem? I have VS 2003, 2005, and 2008 and I am getting this issue in all of them. It seems like after five years they would've found a way to keep the designer from doing this, or at the very least provide us with an error message that will allow us to fix it by hand.

ahaun  Tuesday, February 05, 2008 5:13 AM
I'm getting it in VS2008 SP1 also. The designer is failing on a user control with absolutely no decent way to locate the failure mode in my code. I am reduced to randomly removing lines of code in the user form control.

Thermometer  Saturday, September 13, 2008 5:57 PM
I have had the problem with split containers and have had to redo the entire form but recently had the problem with a single button on a form as I was testing the navigation through the forms.

<Code>

// button1
//
this->button1->Location = System::Drawing::Point(669, 12);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(75, 23);
this->button1->TabIndex = 0;
this->button1->Text = L"Cancel";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &CreateCo::button1_Click);
//
// CreateCo
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(756, 416);
this->ControlBox = false;
this->Controls->Add(this->button1);
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedDialog;
this->Name = L"CreateCo";
this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
this->Text = L"New Company File";
this->ResumeLayout(false);

Code>

The problem being caused by the line in Bold

I removed the control
Installed a new button
Ran in Debug = All OK
Called Form in Designer View and "Circular" problem is back...how does adding a button create this issue?

The Application compiled and works fine in release .exe only problem is I cannot view the specific form in designer view...go figure.

Hands  Saturday, April 04, 2009 11:16 PM

You can use google to search for other answers

Custom Search

More Threads

• PropertyGrid & CollectionEditor change events
• [C# 2.0 winform] Custom Control and Automatic Serialization property on Settings
• Changing font of a control at design time 'breaks' the form
• How to add "Expression" style to all properties displayed in a PropertyGrid (like in SQL Reporting Designer)
• can't save collection in disgner
• Report Filtering C# 2005 - rdlc report
• User controls VB 2005 vs vb 6 "Property Pages"
• Persist Hashtable property
• pre populated listview
• Windows Forms UserControls with Visual C++ .NET 2005