Don't run event in desing time

  • Thread starter Thread starter sergey
  • Start date Start date
S

sergey

I have writed a new class. (Inherited by TextBox)

public class MyTextbox: System.Windows.Forms.TextBox

When I writed it's OnTextChange event, this event runs in design-time and
run-time.

protected override void OnTextChanged(EventArgs e)
{
//do something

MessageBox.Show("changed");

//do something

base.OnTextChanged(e);
}


In this code how can I know is it design-time or run-time. And how can I
prevent to run in design-time.



Best regards...
 
Hi Sergey,

Use the (protected) Component.DesignMode Property.

Cheers,
Michel
 

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