473,386 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

'Circular reference' error but can't find such an error in the code.

I've created in form that has tab controls that contain tab controls that
host user controls on each tab page. It compiles and runs just fine but the
designer view fails with a "A circular control reference has been made. A
control cannot be owned or parented to itself." Additionally, there are a
lot of "Operation is not valid due to the current state of the object."
errors. However, when I look at the code, I do not see any place in the code
that looks like it could be assigning a circular reference. None of the
lines like 'tabMain.Controls.Add(xxx)' are trying to add themselves to the
control collection and all of the relationships look proper. Is there some
other way that this error can be generated?
--
"I used to think I might be indecisive but now I'm not so sure...."
Richard Lewis Haggard
www.Haggard-And-Associates.com
May 1 '06 #1
10 6326
"Richard Lewis Haggard" <HaggardAtWorldDotStdDotCom> wrote in message
news:uy**************@TK2MSFTNGP02.phx.gbl...
I've created in form that has tab controls that contain tab controls that
host user controls on each tab page.


Tab controls on tab controls. Sounds like a bad user interface.

Michael
May 1 '06 #2
SP
"Michael C" <no****@nospam.com> wrote in message
news:uv**************@TK2MSFTNGP05.phx.gbl...
"Richard Lewis Haggard" <HaggardAtWorldDotStdDotCom> wrote in message
news:uy**************@TK2MSFTNGP02.phx.gbl...
I've created in form that has tab controls that contain tab controls that
host user controls on each tab page.


Tab controls on tab controls. Sounds like a bad user interface.


That was a really helpful response!
May 2 '06 #3
"SP" <ec***********@hotmail.com> wrote in message
news:O8****************@TK2MSFTNGP02.phx.gbl...
Tab controls on tab controls. Sounds like a bad user interface.


That was a really helpful response!


I agree. :-)

Michael
May 2 '06 #4
I suggest putting breakpoint & switching to design view
This might lead you to the code - which results in this error

HTH
Kalpesh

May 2 '06 #5
Hi,

"Michael C" <no****@nospam.com> wrote in message
news:uv**************@TK2MSFTNGP05.phx.gbl...
"Richard Lewis Haggard" <HaggardAtWorldDotStdDotCom> wrote in message
news:uy**************@TK2MSFTNGP02.phx.gbl...
I've created in form that has tab controls that contain tab controls that
host user controls on each tab page.


Tab controls on tab controls. Sounds like a bad user interface.


I hav one such construction, in a PPC app not enough space and lot of info
to display :(
May 2 '06 #6
Break on a break point in non-executing code? I was unaware that this was
possible. I put a break on every single function but no break was observed
when viewing in design mode.
--
Richard Lewis Haggard
www.Haggard-And-Associates.com
"Kalpesh" <sh*********@gmail.com> wrote in message
news:11*********************@j33g2000cwa.googlegro ups.com...
I suggest putting breakpoint & switching to design view
This might lead you to the code - which results in this error

HTH
Kalpesh

May 2 '06 #7
Richard,

I didnt try that out.
However, I thought that the controls that you drop on the form at
design time generate code in the background.

Hence, when you switch back & forth - it might run the code to set
properties
Sorry for the inconvenience.

Kalpesh

May 2 '06 #8
Normally, I'd agree with you but in this case, the UI works surprisingly
well for its designated purpose.

Target audience:
internal developers

Goals:
Blindingly obvious to use
Exceedingly easy to extend
UI elements for each test are modular.
Handlers for each test's UI events are encapsulated in separate classes

A nested pair of tabs working in conjunction with user controls satisfy the
design goals - with the one obvious exception that there is some non-obvious
circular reference. If someone has an alternative architecture, I'd be
delighted to hear of it.

Oddly, the project compiles and runs just fine. It is only the form designer
issue that is a problem.
--
"On being told by Rumsfield that three Brazilian soldiers had died in Iraq,
President Bush froze, turned white and, after a pause, asked, "Just exactly
how many is a bazillion?"
Richard Lewis Haggard
www.Haggard-And-Associates.com
"Michael C" <no****@nospam.com> wrote in message
news:uv**************@TK2MSFTNGP05.phx.gbl...
"Richard Lewis Haggard" <HaggardAtWorldDotStdDotCom> wrote in message
news:uy**************@TK2MSFTNGP02.phx.gbl...
I've created in form that has tab controls that contain tab controls that
host user controls on each tab page.


Tab controls on tab controls. Sounds like a bad user interface.

Michael

May 2 '06 #9
Fire up another instance of VS and load your project. Place your
breakpoints and then use the Tools menu to attach to the other
devenv.exe. Then you can debug when it goes into design mode.

May 2 '06 #10
I think that I've found the problem.

The main form had a status label which was intended to display test results.
In order to provide access to this label, I made it public and passed in a
reference to the main form to each of the user controls after that user
control had been created. If I remove the lines that do this for each of the
user controls and then do a solution rebuild (not a project rebuild), then
the design time display of the main form works.

Oddly, I can put the line that passes the main form reference to the user
control classes back in and the design time still displays after each build.
It is only a solution rebuild that will trigger the error condition again
and only a solution rebuild that will remove the error condition.

So, in conclusion, it may be that the user control's form member that was
holding a reference to the parent form was the problem.
--
Richard Lewis Haggard
www.Haggard-And-Associates.com
"Richard Lewis Haggard" <HaggardAtWorldDotStdDotCom> wrote in message
news:uy**************@TK2MSFTNGP02.phx.gbl...
I've created in form that has tab controls that contain tab controls that
host user controls on each tab page. It compiles and runs just fine but
the designer view fails with a "A circular control reference has been
made. A control cannot be owned or parented to itself." Additionally,
there are a lot of "Operation is not valid due to the current state of the
object." errors. However, when I look at the code, I do not see any place
in the code that looks like it could be assigning a circular reference.
None of the lines like 'tabMain.Controls.Add(xxx)' are trying to add
themselves to the control collection and all of the relationships look
proper. Is there some other way that this error can be generated?
--
"I used to think I might be indecisive but now I'm not so sure...."
Richard Lewis Haggard
www.Haggard-And-Associates.com

May 2 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: dotnetnewbie | last post by:
Hi all I am new to .NET and webservice so I wish someone can shed some light on me. I have a Project class and a Product class, the Project can contain multiple Products (as an ArrayList). In...
6
by: T Koster | last post by:
After a few years of programming C, I had come to believe that I finally knew how to correctly organise my structure definitions in header files for mutually dependent structures, but I find myself...
12
by: Frank Rizzo | last post by:
I have a circular reference between 2 classes in the same project (i.e. each class refers to the other). The app runs fine and I am seeing no issues, which kind of surprised me. Are there any...
8
by: Jeff Connelly | last post by:
We're getting this error and don't know where to find the problem. I assume this is usually issued in the typical case where project A has a reference to project B, and project B has a reference...
6
by: Stephen Robertson | last post by:
We are currently in a dead end with a circular reference issue using vb.net, and are hoping someone might help us resolve it. Idea... We have frmmain calling frmperson (dim f as new frmperson)...
3
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post by:
Hi I Have a solution with about 50 projects and each project have References to 1 to n of the projects in the solution. I try go to a project and try to add a reference to another project and I...
2
by: Jeremy Kitchen | last post by:
I have inherited a project and I am trying to figure out why the failing units tests that exist fail. I a, getting the following error when I attempt serialization. Any advice on what I should...
3
by: =?Utf-8?B?UGF1bCBIYWxl?= | last post by:
Moving all User Controls to a single directory has solved my problem - Thanks Eliyahu. That said, I still got one Circular ref error yesterday, rebuilt again and the build was fine? Far far...
3
by: shapper | last post by:
Hello, On an ASP.NET MVC project I am getting a list of Tags which names start with a string contained on the variable "q". Everything works fine if no Post is related to Tags. When there is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.