Solved

Form loses all controls and formatting in [Design] View, even though the designer code is fine.

Posted on 2008-06-12
15
205 Views
Last Modified: 2013-12-17
I made no changes to this form, nothing at all.  Yet all of a sudden, everything just "dissapears" and it looks like a completely new form.  I checked the form designer code and everything is fine, no errors are reported, my form just completely *insert bad word here* vanished!

Now, I have tried several things to fix this, and nothing has worked so far.  The oddities that I noticed was that.

A.)  When I try to edit code in the designer code, nothing stays, e.g. everytime the form is "viewed" in the Visual c# program, the changes I made in the designer code is completely un-done.

B.)  this.Performlayout();  is no longer at the bottom of the designer code.  As shown below is should look something like this, but I can not insert "this.PerformLayout();", I can but it doesnt save.

//
// frmName
//
*insert code here*
this.PerformLayout();

I am not really good with the form designer code, but I am assuming this must be essential because I see it in all the other forms form designer code.
0
Comment
Question by:recruitit
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 5
15 Comments
 
LVL 6

Expert Comment

by:MuhammadAdil
ID: 21768733
Visual Solutions some time behave abnormally.

Try to clean you solution.

Can you show your code. Or send me your source code I'll check that..

Regards,
Adil Fazal
0
 

Author Comment

by:recruitit
ID: 21768814
The designer code or the form code?

I cant supply you with the form code, plus that fact that it is enormous, over 2800 lines of code.

The only thing that should matter here is the designer code, which as I said before, the only thing that is missing is this.PerformLayout();  which it wont allow me to actually insert this back in forwhatever reason that it initially vanished in the first place.

0
 

Author Comment

by:recruitit
ID: 21768819
I must mention that I have 23 Windows Forms in my solution and this is the only one receiving the problem.
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 

Author Comment

by:recruitit
ID: 21768848
Actually, I tell you what, the major problem here is that the designer code isnt saving my changes.  Is there anyway to fix that?
0
 
LVL 6

Expert Comment

by:MuhammadAdil
ID: 21768873
One trick you can apply. Copy your form design and code file to other place. Then delete from solution. And then copied file to you solution again. Let me update.

Regards,
Adil Fazal
0
 
LVL 6

Expert Comment

by:MuhammadAdil
ID: 21768888
Only that form's file that are creating problem...

Regards,
Adil Fazal
0
 

Author Comment

by:recruitit
ID: 21768963
Hmm, didnt work.  Cut the 3 files out for the form, deleted it from the project, then copied back, add existing item (selected the three form items), and it came back with the same problem.

0
 

Author Comment

by:recruitit
ID: 21769079
Also, just extracted it and put it into a completely new project, with just its own three files, cs, resx, designer.cs.  Again same problem,  the Designer.cs will not keep any changes I make, they just disapear as soon as the form gets loaded into the visual
0
 

Author Comment

by:recruitit
ID: 21769100
I am almost 100% sure that because     this.PerformLayout();   is not present under the frmName in the designer code, that is whats causing the form to appear blank, what completely escapes me is that i can edit the designer code, any changes at all are reverted as soon as I look at the form in Design view.
0
 

Author Comment

by:recruitit
ID: 21769161
I just modified the file directly from windows explorer, and the changes where wiped.
0
 
LVL 6

Expert Comment

by:MuhammadAdil
ID: 21769241
you can add these file at cs in constructor file after InitializeComponent Method ...
this.PerformLayout();

Regards,
Adil Fazal
0
 

Author Comment

by:recruitit
ID: 21769310
Well doh, that didnt solve it either.  Guess that isnt the problem.
0
 
LVL 6

Accepted Solution

by:
MuhammadAdil earned 500 total points
ID: 21769351
Ok. You should attach you code. EE facilitate to attach files.

Regards,
Adil Fazal
0
 

Author Comment

by:recruitit
ID: 21769549
Oh god, I just discovered whats happend, I have lost LOADS of code,  at the moment this is what my form designer code looks like for the frm itself...

this.ClientSize = new System.Drawing.Size(292, 260);
            this.Name = "...";
            this.....ResumeLayout(false);
            this.....ResumeLayout(false);
            this.....ResumeLayout(false);
            this.....ResumeLayout(false);
            this.....PerformLayout();
            this......ResumeLayout(false);
            this......PerformLayout();
            this......ResumeLayout(false);
            this......ResumeLayout(false);
            this......PerformLayout();
            this......ResumeLayout(false);
            this......PerformLayout();
            this.ResumeLayout(false);

When there should be loads of this.Controls.Add(bla);

etc etc... ugh
0
 

Author Comment

by:recruitit
ID: 21769689
Not only that but every single Event for each control has been completely severed.  All the codes there, I am just going to have to replace everything.

Thanks for the help.
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question