By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,896 Members | 2,002 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,896 IT Pros & Developers. It's quick & easy.

how to use equivalent of DesignMode in InitializeComponent() ??

P: n/a
I'm using the ActiveX interop to include an activeX control on a C# form.

In InitializeComponent(), there is a call like:

this.myControl = new AxMywinLib.AxMyWin();

I would like to support the case of to allow the control to pre-exist at
runtime. That is, do something like:

if( !this.DesignMode ) {
myControl = SomeOtherClass.myControl;
} else
this.myControl = new AxMywinLib.AxMyWin();

but VS2003 objects to any code of this sort - complaining that when I go to
design mode:

AN error occurred while loading the document. Fix the error, and then try
loading the document again. The error message follows:

The designer cannot process the code at line 53:

line: 53 if( !this.DesignMode )

From looking around the web, I believe also that DesignMode is not 100%
accurate. Any suggestions?

thanks,
/steveA

--
Steve Alpert
my email fgrir.nycreg @ tr.pbz is encrypted with ROT13 (www.rot13.org) and spaces

Sep 28 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.