468,248 Members | 1,533 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,248 developers. It's quick & easy.

MdiForm Design is gone!

What would cause VS2005 Pro to lose all of my MdiForm Design information?

I've been working on one of the Child Forms and having problems with the
Child Form's threads not completing (locking up and not responding anymore).

So, I shut down VS, turned off my PC, then turned everything back on.

Now, my MdiForm Design looks like a blank form whenever a new form is added
to a project. My Tray Icon, Status Bar strip, and Main Menu are all there,
but nothing is on the form.

What would cause Visual Studio to dump this? Is there a way that I can
salvage it? (probably not)
Aug 4 '08 #1
6 2051

"jp2msft" wrote:
What would cause VS2005 Pro to lose all of my MdiForm Design information?

I've been working on one of the Child Forms and having problems with the
Child Form's threads not completing (locking up and not responding anymore).

So, I shut down VS, turned off my PC, then turned everything back on.

Now, my MdiForm Design looks like a blank form whenever a new form is added
to a project. My Tray Icon, Status Bar strip, and Main Menu are all there,
but nothing is on the form.

What would cause Visual Studio to dump this? Is there a way that I can
salvage it? (probably not)
Hi,

What MdiForm design do you mean? As far as I know the VS designer wont
display child windows at design time, so how are you able to see them on the
MdiForm. Or do you mean UserControls? These can be dragged onto any form or
control and be displayed in the VS designer. However, an MdiForm also has a
MdiClient control added to it. If the MdiClient is somehow pushed topmost
(like MdiClient.BringToFront()) all other controls will appear to vanish as
they are put underneath.

If you are putting UserControls on your MdiParent and they vanish I'm
guessing the MdiClient is covering them. If so, try checking your code for a
MdiClient reference and make sure you aren't putting it in front of the
usercontrols.

--
Happy Coding!
Morten Wennevik [C# MVP]

Aug 5 '08 #2
"Morten Wennevik [C# MVP]" wrote:
>
"jp2msft" wrote:
What would cause VS2005 Pro to lose all of my MdiForm Design information?

I've been working on one of the Child Forms and having problems with the
Child Form's threads not completing (locking up and not responding anymore).

So, I shut down VS, turned off my PC, then turned everything back on.

Now, my MdiForm Design looks like a blank form whenever a new form is added
to a project. My Tray Icon, Status Bar strip, and Main Menu are all there,
but nothing is on the form.

What would cause Visual Studio to dump this? Is there a way that I can
salvage it? (probably not)

Hi,

What MdiForm design do you mean? As far as I know the VS designer wont
display child windows at design time, so how are you able to see them on the
MdiForm. Or do you mean UserControls? These can be dragged onto any form or
control and be displayed in the VS designer. However, an MdiForm also has a
MdiClient control added to it. If the MdiClient is somehow pushed topmost
(like MdiClient.BringToFront()) all other controls will appear to vanish as
they are put underneath.

If you are putting UserControls on your MdiParent and they vanish I'm
guessing the MdiClient is covering them. If so, try checking your code for a
MdiClient reference and make sure you aren't putting it in front of the
usercontrols.

--
Happy Coding!
Morten Wennevik [C# MVP]
Mr. Wennevik,

Actually, what has happened is that my MdiForm lost all of its settings. The
Main Menu, Status Bar, and Tray Icon controls still appear in Design Mode,
but the Main Form has lost all of its settings. The name is now "Form1"
(where it was my application's name), it is not set to be an MDI Form, there
is no Menu associated with the form (even though the Main Menu is still
located there), my application's icon is gone, ...everything has been reset!
You name it - it is no longer on my MDI form.
Aug 5 '08 #3
"jp2msft" wrote:
"Morten Wennevik [C# MVP]" wrote:

"jp2msft" wrote:
What would cause VS2005 Pro to lose all of my MdiForm Design information?
>
I've been working on one of the Child Forms and having problems with the
Child Form's threads not completing (locking up and not responding anymore).
>
So, I shut down VS, turned off my PC, then turned everything back on.
>
Now, my MdiForm Design looks like a blank form whenever a new form is added
to a project. My Tray Icon, Status Bar strip, and Main Menu are all there,
but nothing is on the form.
>
What would cause Visual Studio to dump this? Is there a way that I can
salvage it? (probably not)
Hi,

What MdiForm design do you mean? As far as I know the VS designer wont
display child windows at design time, so how are you able to see them on the
MdiForm. Or do you mean UserControls? These can be dragged onto any form or
control and be displayed in the VS designer. However, an MdiForm also has a
MdiClient control added to it. If the MdiClient is somehow pushed topmost
(like MdiClient.BringToFront()) all other controls will appear to vanish as
they are put underneath.

If you are putting UserControls on your MdiParent and they vanish I'm
guessing the MdiClient is covering them. If so, try checking your code for a
MdiClient reference and make sure you aren't putting it in front of the
usercontrols.

--
Happy Coding!
Morten Wennevik [C# MVP]

Mr. Wennevik,

Actually, what has happened is that my MdiForm lost all of its settings. The
Main Menu, Status Bar, and Tray Icon controls still appear in Design Mode,
but the Main Form has lost all of its settings. The name is now "Form1"
(where it was my application's name), it is not set to be an MDI Form, there
is no Menu associated with the form (even though the Main Menu is still
located there), my application's icon is gone, ...everything has been reset!
You name it - it is no longer on my MDI form.
Ah,

It sounds like Visual Studio in the chaos found the need to recreate the
form.designer.cs file and thereby managed to overwrite the original settings.
In that case, your old settings are probably gone unless you have some form
of source control. If you do have source control, replace the entire content
of <mdiform>.designer.cs with the older version. Also make sure you have a
call to InitializeComponent() in the constructor.

--
Happy Coding!
Morten Wennevik [C# MVP]

Aug 5 '08 #4
"Morten Wennevik [C# MVP]" wrote:
Ah,

It sounds like Visual Studio in the chaos found the need to recreate the
form.designer.cs file and thereby managed to overwrite the original settings.
In that case, your old settings are probably gone unless you have some form
of source control. If you do have source control, replace the entire content
of <mdiform>.designer.cs with the older version. Also make sure you have a
call to InitializeComponent() in the constructor.
I've got most of my fields added back onto the form by now. My problem now
is getting my Main Menu back!

Any idea how to do this?

I have specified that the Main Menu is the MdiForm's MainMenuStrip item, but
it does not actually appear on the form.

I don't suppose you would have any idea of how to do this?

I'd really rather not have to recreate my Main Menu, as I go through and
replace all of Visual Studio's very long names with something much simpler
(toolstripmenuitemFileOpen with miOpen), and that takes *hours* to do!
Aug 5 '08 #5
Ok, I found what I needed:

In the MdiForm's Designer.cs file, I added these items:

this.Controls.Add(this.MainMenu);
this.Controls.Add(this.StatusBar);
this.Controls.Add(this.TrayIcon);

However, the instructions say "do not modify the contents of this method
with the code editor."

Will my changes be lost? How do I ensure that these settings stay?

"jp2msft" wrote:
"Morten Wennevik [C# MVP]" wrote:
Ah,

It sounds like Visual Studio in the chaos found the need to recreate the
form.designer.cs file and thereby managed to overwrite the original settings.
In that case, your old settings are probably gone unless you have some form
of source control. If you do have source control, replace the entire content
of <mdiform>.designer.cs with the older version. Also make sure you have a
call to InitializeComponent() in the constructor.

I've got most of my fields added back onto the form by now. My problem now
is getting my Main Menu back!

Any idea how to do this?

I have specified that the Main Menu is the MdiForm's MainMenuStrip item, but
it does not actually appear on the form.

I don't suppose you would have any idea of how to do this?

I'd really rather not have to recreate my Main Menu, as I go through and
replace all of Visual Studio's very long names with something much simpler
(toolstripmenuitemFileOpen with miOpen), and that takes *hours* to do!
Aug 5 '08 #6

"jp2msft" wrote:
Ok, I found what I needed:

In the MdiForm's Designer.cs file, I added these items:

this.Controls.Add(this.MainMenu);
this.Controls.Add(this.StatusBar);
this.Controls.Add(this.TrayIcon);

However, the instructions say "do not modify the contents of this method
with the code editor."

Will my changes be lost? How do I ensure that these settings stay?

"jp2msft" wrote:
As long as you make sure you use the correct format when editing the
designer file you should be safe. The section is handled by Visual Studio
but editing it manually should update the designer as well. To add a control
to the designer section manually you need to add tre parts shown below.
After you add them go to the designer view and the control should pop up.
The safest way is to then cut away the control and paste it back. This will
let Visual Studio write the correct lines of code. Simpler things like
moving controls from one container to another, changing properties etc can be
done manually in the designer code just fine. You should, however, leave the
name property untouched in the designer file and change this in the designer
instead.

this.myControl = new MyControl();

....
///
/// myControl
///
this.myControl.Property1 = ...
....
....

private MyControl myControl;

--
Happy Coding!
Morten Wennevik [C# MVP]

Aug 6 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.