Prevent Running Code in IDE Design

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello All,

Is there a way to prevent control initialization code from running in design
mode in the IDE (in other words, when I bring up the form to edit it)?

It seems like it should be simple, but darned if I can't figure out where
I've overlooked it...

Thanks,
pagates
 
pagates,

You will want to take a look at the DesignMode property exposed by the
Control class (inherited from the Component class). If this returns true,
then you are in design mode, and probably shouldn't call your code =)

Hope this helps.
 
Nicholas said:
You will want to take a look at the DesignMode property exposed by the
Control class (inherited from the Component class). If this returns true,
then you are in design mode, and probably shouldn't call your code =)

Hope this helps.

I don't know about 2005, but in 2003 this property didn't work properly
(only worked on top-level controls or something!), so the workaround was
to test the process name for devenv.exe. A quick Google should provide
more info :)
 

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

Back
Top