Editing Form1.Designer.cs - Major misstake

  • Thread starter Anders Eriksson
  • Start date
A

Anders Eriksson

Hello,

In my program I had a splitcontainer that I after a while realized that I
didn't want. Since I couldn't remove it in Form1.cs (Design) I opened
Form1.Designer.cs and removed all code that had anything to do with the
splitcontainer.

Now all components are gone from Form1.cs(Design)
They are there in Form1.Designer.cs

I could take the backup but then I will miss a days work. Is there some
other way?

PLEASE HELP!

// Anders

--
English is not my first language
so any error, insults or strangeness
has happend during the translation.
Please correct my English so that I
may become better at it!
 
J

Jeff Johnson

In my program I had a splitcontainer that I after a while realized that I
didn't want. Since I couldn't remove it in Form1.cs (Design) I opened
Form1.Designer.cs and removed all code that had anything to do with the
splitcontainer.

Now all components are gone from Form1.cs(Design)
They are there in Form1.Designer.cs

I could take the backup but then I will miss a days work. Is there some
other way?

PLEASE HELP!

Open your backup. You should note that certain controls are being added to
your split container (or perhaps one of its panels; I'm not positive). It
will look like this:

this.splitContainer1.Controls.Add(someButton);
this.splitContainer1.Controls.Add(someCheckBox);

and so on. What you need to do is to add these controls to a different
container, like perhaps the form itself:

this.Controls.Add(someButton);
this.Controls.Add(someCheckBox);

After you do this you should see all your controls magically return.
 
A

Anders Eriksson

Hello Jeff,
After you do this you should see all your controls magically return.
You are a real David Copperfield!

Thank you very much! Saved my day (night really)

// Anders
 

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