Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Controls / January 2006

Tip: Looking for answers? Try searching our database.

Controls on form have disappeared

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Al Cadalzo - 16 Jan 2006 14:21 GMT
In VS2005 after I saved my project, the next time I opened it, the main form
was missing all its controls.  I had placed 3 buttons and a label on the
form and the project had been running successfully.  I did some
investigation and determined that there were 4 lines of code missing from
the Designer.cs which caused the controls to not appear.  The 4 lines of
code missing were:

this.Controls.Add(this.btnGo);
this.Controls.Add(this.GoClientRE);
this.Controls.Add(this.btnClose);
this.Controls.Add(this.label1);

Once I added these lines back in and rewired the event handlers, everything
worked fine as before.  Any ideas what may have caused this?
Morten Wennevik - 16 Jan 2006 17:26 GMT
Hi Al,

A wild guess, were you at some time editing inside InitializeComponent() (not counting when you added them back)?

> In VS2005 after I saved my project, the next time I opened it, the main form
> was missing all its controls.  I had placed 3 buttons and a label on the
[quoted text clipped - 10 lines]
> Once I added these lines back in and rewired the event handlers, everything
> worked fine as before.  Any ideas what may have caused this?

Signature

Happy coding!
Morten Wennevik [C# MVP]

Al Cadalzo - 27 Jan 2006 11:21 GMT
Morten,
I wasn't editing inside InitializeComponent() but I was using the Properties
window to hookup the button event handlers.  Could that have caused it?

> Hi Al,
>
[quoted text clipped - 17 lines]
>> everything
>> worked fine as before.  Any ideas what may have caused this?
Morten Wennevik - 29 Jan 2006 11:16 GMT
Using the properties window is the best.  If you edit inside InitializeComponent you run the risk of Visual Studio overwriting your changes leading to unexpected behaviour.  Not sure why you get that error.

> Morten,
> I wasn't editing inside InitializeComponent() but I was using the Properties
[quoted text clipped - 25 lines]
>> Happy coding!
>> Morten Wennevik [C# MVP]

Signature

Happy coding!
Morten Wennevik [C# MVP]


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.