Microsoft has let me down -- form breaks in designer

D

Daniel Manes

Sorry for cross-posting this all over the place, but I've already lost
two days to this problem, and I'm at my wits end. I've searched the
usenet archives up and down and tried everything I can think of, but I
just can't get the Visual Studio designer to stop breaking on me.

My problem is that, when I open my form in the designer, I get an error
dialog, and then when I accept the dialog, one of the TabPages of the
TabControl is broken--there's an error message with a big red X
plastered all over it.

This happens even though I've just been using the designer (i.e., the
GUI). I haven't written a single line of code yet.

I can't reproduce exactly what I did (too many steps), but here's a
rundown of what happened (with links to screen captures):

== If you need more info to help me, please ask and I'll provide
whatever I can. ==
1. Create TabControl (contains Tab1 and Tab2)
2. Place a bunch of controls
3. Add data bindings for two DataGridViews (one on Tab1, one on Tab2)
== everything fine so far ==
4. Add a new tab (Tab3 -- no controls)
== still fine ==
5. Move Tab3 to beginning (new order: Tab3, Tab1, Tab2)
== stops working! ==

When I open the form, I get this error dialog:
http://members.cox.net/danthman/pictures/VSErrorDialog.jpg

Then, when I hit OK, the form is broken.
http://members.cox.net/danthman/pictures/VSBrokenForm.jpg

6. Remove Tab3
== works fine again ==
7. Add two new tabs
8. Move both tabs to the beginning (new order: Tab3, Tab4, Tab1, Tab2)
== stops working again ==

At this point, the document outline looks like this:
http://members.cox.net/danthman/pictures/VSDocumentOutline.jpg

9. Remove both tabs
== works fine again ==
10. Remove data bindings
11. Add a new tab
12. Move tab to beginning
== still works fine ==
13. Add data bindings
== stops working again ==

Thanks,

Dan

P.S. Not sure if html works here, but here are the links in html:
<a
href="http://members.cox.net/danthman/pictures/VSErrorDialog.jpg>Error
Dialog</a>
<a
href="http://members.cox.net/danthman/pictures/BrokenForm.jpg>BrokenForm</a>
<a
href="http://members.cox.net/danthman/pictures/VSDocumentOutline.jpg>DocumentOutline</a>
 
J

JP

This occurs when the the designer partial class code
(Form1.designer.cs) breaks. Take a look there in the "Windows Form
Designer generated code" for two definitions of the offending control.
Its likely you added the control, removed a panel, then readded again
and the designer code didn't keep up with the activity. Hope this
helps.
 
D

Daniel Manes

Hi JP,

Thanks, but I'm pretty sure that's not the problem. Only one
declaration/instance of the offending control shows up in the designer
code. Also, I've actually rebuilt this form from scratch several times
(including using a brand new project), but I always get the same error.
The error even occurs if I add all the controls sequentially and
without moving, copying, pasting, deleting or doing anything else that
might confuse the designer.

So, I've now submitted a bug report to Microsoft. Hopefully the problem
will be solved in a future release. Meanwhile, anyone experiencing this
problem will either have to either live with not being able to see
what's on certain tab pages or temporarily removing the bindings from
problematic tab pages. Fortunately, I discovered after some recent
testing that the form actually compiles without errors and runs--it's
strictly a problem with design mode.

Thanks again for taking a look at this,

-Dan
 
B

Bruce Wood

Daniel said:
Hi JP,

Thanks, but I'm pretty sure that's not the problem. Only one
declaration/instance of the offending control shows up in the designer
code. Also, I've actually rebuilt this form from scratch several times
(including using a brand new project), but I always get the same error.
The error even occurs if I add all the controls sequentially and
without moving, copying, pasting, deleting or doing anything else that
might confuse the designer.

So, I've now submitted a bug report to Microsoft. Hopefully the problem
will be solved in a future release. Meanwhile, anyone experiencing this
problem will either have to either live with not being able to see
what's on certain tab pages or temporarily removing the bindings from
problematic tab pages. Fortunately, I discovered after some recent
testing that the form actually compiles without errors and runs--it's
strictly a problem with design mode.

Thanks again for taking a look at this,

-Dan

I know that this is probably a lame suggestion, but...

.... could you create a UserControl that contains all of the stuff on a
tab page, do the bindings in your UserControl, then just place the
UserControl on the TabPage?

That would avoid having to do everything all in one form, which might
get around your designer bug.
 
H

havish14

Did you try installing the latest hotfix for VS2005 on your system. I
had a similar kind of problem with the designer but it went away after
I installed the hotfix.
 

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