Control in Runtime vs Designtime

J

Johnny Jörgensen

I would like to be able to tell whether my component code is executed when I
instanciate a control in runtime or in designtime.

Can anybody give me a clua as to how you can do that?

Cheers,
Johnny J.
 
A

Armin Zingler

Johnny Jörgensen said:
I would like to be able to tell whether my component code is
executed when I instanciate a control in runtime or in designtime.

Can anybody give me a clua as to how you can do that?


Check the control's DesignMode property (Me.Designmode). It is true, if the
designer instanciates the control in order to put it onto a Form to be
designed.


Armin
 
M

Michael Huber

use the DesignMode - Property

Control ctrl = new Control();
if (ctrl.DesignMode)
{
//is in designMode
}
 
J

Johnny Jörgensen

Thanks both of you - It was much simpler than I had expected... ;-)

/Johnny J.
 

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