Control in Runtime vs Designtime

  • Thread starter Thread starter Johnny Jörgensen
  • Start date Start date
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.
 
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
 
use the DesignMode - Property

Control ctrl = new Control();
if (ctrl.DesignMode)
{
//is in designMode
}
 
Thanks both of you - It was much simpler than I had expected... ;-)

/Johnny J.
 
Back
Top