471,605 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,605 software developers and data experts.

Prevent Running Code in IDE Design

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
Dec 1 '05 #1
2 1561
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 Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"pagates" <pa*****@discussions.microsoft.com> wrote in message
news:C7**********************************@microsof t.com...
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

Dec 1 '05 #2
Nicholas Paldino [.NET/C# MVP] wrote:
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 :)
Dec 1 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Fred Zuckerman | last post: by
reply views Thread by ibenc | last post: by
1 post views Thread by RICHARD BROMBERG | last post: by
reply views Thread by CCCYYYY | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.