Disappearing User Controls in VS 2005

A

ARayB

We've suddenly had all of the controls, user and otherwise
disappear from their containing form in VS2005 (SP1).
The form included a grid, labels, tab control and a number
of instances of a user control

The project compiles cleanly and the controls are all visible
at runtime just not anywhere to be seen in the ide.

I see MS has a fix for this a while back in VS 2003 but what
about 2005? Any experiences or advice??
 
G

Guest

Occasionaly i open a form in VS2005 and the form shows blank and of teh
default size. If i closed all the documents then open it again it is normally
sorted.
If this is working ok at runtime then it must a visual studio issue.

Do you get any error messages from it?
 
A

ARayB

Occasionaly i open a form in VS2005 and the form shows blank and of teh
default size. If i closed all the documents then open it again it is normally
sorted.
If this is working ok at runtime then it must a visual studio issue.

Do you get any error messages from it?

Thanks for the response, Ciaran. We don't see any errors. The form
is the default size and all of the form code is remaining as are the
definitions
in the .designer.cs file for the form.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

ARayB said:
We've suddenly had all of the controls, user and otherwise
disappear from their containing form in VS2005 (SP1).
The form included a grid, labels, tab control and a number
of instances of a user control

The project compiles cleanly and the controls are all visible
at runtime just not anywhere to be seen in the ide.

I see MS has a fix for this a while back in VS 2003 but what
about 2005? Any experiences or advice??

This has happened to me before, not only that but the designer says that
there are some missing files (or other error) and that cannot display the
form.

I dont remember the exact solution but goes by closing the IDE, rebuild the
solution and try again.

BTW, did you updated to SP1?
 
A

ARayB

Hi,






This has happened to me before, not only that but the designer says that
there are some missing files (or other error) and that cannot display the
form.

I dont remember the exact solution but goes by closing the IDE, rebuild the
solution and try again.

BTW, did you updated to SP1?

Yes, we are using SP1. The 'we' being my coworker(running Vista) and
myself(XP Pro) and, BTW, the
problem appears on both our workstations in the same way. The
project's been
closed, reopened and recompiled multiple times on both machines.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,


Yes, we are using SP1. The 'we' being my coworker(running Vista) and
myself(XP Pro) and, BTW, the
problem appears on both our workstations in the same way. The
project's been
closed, reopened and recompiled multiple times on both machines.

Check the code of that form (both the designer's code as well as yours) and
compare it to another form that is working fine.

Must probably the code is missing something that is required by the designer
but that runs fine.
 
B

Barfy the Wonder Camel

We've suddenly had all of the controls, user and otherwise
disappear from their containing form in VS2005 (SP1).
The form included a grid, labels, tab control and a number
of instances of a user control

The project compiles cleanly and the controls are all visible
at runtime just not anywhere to be seen in the ide.

I see MS has a fix for this a while back in VS 2003 but what
about 2005? Any experiences or advice??

have you looked at the Document Outline window? Maybe the offending
controls are placed behind something. Format -> Bring to Front might
fix it.
 
A

ARayB

have you looked at the Document Outline window? Maybe the offending
controls are placed behind something. Format -> Bring to Front might
fix it.

Isn't the document outline window used for web forms? This is a
windows forms application.
In addition, not only are the controls missing but the form shows up
as the default size as
it would in a new project.
 
B

Barfy the Wonder Camel

Isn't the document outline window used for web forms? This is a
windows forms application.
In addition, not only are the controls missing but the form shows up
as the default size as
it would in a new project.- Hide quoted text -

- Show quoted text -

Heck no! I use the document outline on windows forms projects. It's
very handy for determining the heirarchy of containers and um
containees. Many times I've dropped a control on a panel (I thought)
only to have it get owned by the parent form or the tab control
because I didn't have the panel selected. I move it around in the
document outline and all is wonderful again.

As to your comment about the form, it almost sounds like it's a
different form from the one you think you're working on. I'd start
examining the other xxxx.designer.cs files in the partial class --
look at the actual control creation code. If it's even there.

You might also try (if you haven't already) removing the resx file.
 
A

ARayB

Heck no! I use the document outline on windows forms projects. It's
very handy for determining the heirarchy of containers and um
containees. Many times I've dropped a control on a panel (I thought)
only to have it get owned by the parent form or the tab control
because I didn't have the panel selected. I move it around in the
document outline and all is wonderful again.

As to your comment about the form, it almost sounds like it's a
different form from the one you think you're working on. I'd start
examining the other xxxx.designer.cs files in the partial class --
look at the actual control creation code. If it's even there.

You might also try (if you haven't already) removing the resx file

One thing more that makes this a head-scratching problem is that
this is the only form in the project. The document outline is as empty
as the form is in the ide. ;-(
 
M

Mike Channin

I've just had a very similar issue. Working away quite happily, switched
to Form Design view - bang - the form display flashed and all the
controls disappeared, leaving only a blank (resized) form (as it first
appears, default size, no controls). Compiled and built fine, but could
not get the Form to display in the designer, no matter what. Shutting
down and restarting made no difference. Multiple rebuilds made no
difference.

Turns out that I'd accidentally collided with the Designer generated
InitializeControl() method (in the designer generated part of
<form>.Designer.cs) when refactoring in <form>.cs and broken it. Once
this was all resolved, the Form Design view magically appeared again.

Wasted a few hours tracking it down though.

Hope this helps anyone with a similar issue.

Mike.
 
A

ARayB

I've just had a very similar issue. Working away quite happily, switched
to Form Design view - bang - the form display flashed and all the
controls disappeared, leaving only a blank (resized) form (as it first
appears, default size, no controls). Compiled and built fine, but could
not get the Form to display in the designer, no matter what. Shutting
down and restarting made no difference. Multiple rebuilds made no
difference.

Turns out that I'd accidentally collided with the Designer generated
InitializeControl() method (in the designer generated part of
<form>.Designer.cs) when refactoring in <form>.cs and broken it. Once
this was all resolved, the Form Design view magically appeared again.

Wasted a few hours tracking it down though.

Hope this helps anyone with a similar issue.

Mike.

Mike, to fix the problem, did you have to directly edit
the .Designer.cs file?
 
D

d g

Thanks for the hints guys... I fixed my problem

My situation was:

1) Multiple Forms on .NET 2005 CSharp project (XP Pro SP2)
2) One form showed as blank with default size, though yesterday the
controls showed, and everything was fine. Other forms in project showed
as normal.
3) Designer file showed controls still there

I opened an older version of the project to see what changed, I found
that in Designer.cs, in the "InitializeComponent()" where the form
itself is having things done, quite a bit of code was missing, including
the initial properties of the form, and the adding of the controls...
for starters I had to put in a series of

this.Controls.Add(this.button1); // etc

for every control, along with some other basic things like the icon,
start position, etc

Very strange, I'm not sure how this happened (or even when).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top