I found several references to disappearing controls in VS2003, but they all said the problem had been fixed in VS2005.
The cause of this turned out to be that some lines had removed themselves from the designer.cs file :-
///
/// formMyForm
///
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ClientSize = new System.Drawing.Size(869, 717);
this.Controls.Add(this.splitContainer1);
this.Controls.Add(this.buttonOK);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonAccept);
this.Name = "formMyForm";
this.Text = "My form title";
Copying these lines from the version in source control seemed to restore all the controls in the dialog.
4 comments:
Yeah I've been using windows forms recently and I cannot believe the things that go on in vs2005 - if you use tab controls you need to continually load another form and then go back to it - textboxs that exist on the deigner but not in the code anywhere - poor show.
Dude, this happens to me with VS2005 ALL THE TIME! I just spent two frustrating days trying to rebuild a toolstrip with a dozen buttons on it, all mapped to important event handlers, that just mysteriously blipped away one day with zero reason. Only after searching Google for others experiencing the same problem did I patiently look through the designer.cs file and find that my this.toolStrip_CityGuideRestaurants toolstrip had been automagically set with a Visible = false; value. I couldn't believe it. I set it to true and ran the app and my toolbar was back. But, no kidding, on that same run ANOTHER toolbar vanished and this time after searching the designer.cs file the line that tells whether the control is visible or not was GONE! I had to manually enter the line setting the control's "Visible" value to true. Damn! OUTRAGEOUSLY FRUSTRATING! After this little adventure all I can say is thank God that I didn't have to write everything from scratch after all.
Vulfie
same thing happended to me in VS2005 [VS bug]
I just encountered the same problem in a form a had built and previously compiled in VS2005. I opened it to continue work on it and - no menu bar! Following up on the clues given in this blog-post and comments, I discovered that a line had vanished from my form's Form.Designer.vb file:
Me.menu1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.menuFile, Me.menuMark, Me.menuTools, Me.menuHelp})
All the child objects and their children were still defined in the Designer.vb file, but VS had taken it upon itself to cast the whole tribe adrift as orphans in a netherworld no longer visible on the surface of the form.
Post a Comment