Detecting Windows Forms Desginer

J

John Bowman

Hi All,

When VS 2005 visual designer attempts to open an inherited windows form it
attempts to instantiate the form. Unfortunately, this does not work under
certain conditions/needs to the form's constructor. You get a nasty error
something like: "One or more errors encountered while loading the designer.
The errors are listed below. Some errors can be fixed by rebuilding your
project, while others may require code changes." Well, I've tracked this
down as to what's causing it. I need to be able to detect in the form's
constructor that it's being instantiated by Visual Studio so I can insert
some special code that fixes that problem when the form is instantitated via
VS. I'm, sure I came accross something like that a while ago somewhere, but
now I cannot find it. Can someone please point me to how to go about
detecting when VS designer is attempting to instantiate a windows form?

TIA,


John C. Bowman
Software Engineer
Thermo Electron Scientific Instruments Div.
<Remove this before reply> (e-mail address removed)
 
K

Kevin Spencer

Use Component.DesignMode to determine whether the app is being run in Design
mode:

if (!DesignMode)
{
//.....
}

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

What You Seek Is What You Get.
 
J

John Bowman

Kevin,

Thanks, that was the ticket...

John


Kevin Spencer said:
Use Component.DesignMode to determine whether the app is being run in
Design mode:

if (!DesignMode)
{
//.....
}

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

What You Seek Is What You Get.
 

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