|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Detecting Windows Forms DesginerWhen 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> john.bow***@thermo.com Use Component.DesignMode to determine whether the app is being run in Design
mode: if (!DesignMode) { //..... } -- Show quoteHTH, Kevin Spencer Microsoft MVP Chicken Salad Surgery What You Seek Is What You Get. "John Bowman john.bow***@thermo.com>" <<Remove this before reply> wrote in message news:u0KXVPo0GHA.2036@TK2MSFTNGP05.phx.gbl... > 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> john.bow***@thermo.com > Kevin,
Thanks, that was the ticket... John Show quote "Kevin Spencer" <u**@ftc.gov> wrote in message news:eizRDqp0GHA.4796@TK2MSFTNGP06.phx.gbl... > 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. > > "John Bowman john.bow***@thermo.com>" <<Remove this before reply> wrote in > message news:u0KXVPo0GHA.2036@TK2MSFTNGP05.phx.gbl... >> 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> john.bow***@thermo.com >> > > |
|||||||||||||||||||||||