Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to suppress the OnClick event 1

Status
Not open for further replies.

MKuiper

Programmer
Jan 29, 2002
364
NL
Hi,

I have created a class derived from Button (WinForms).
If a certain condition within the class is true, I don't want the OnClick event to be fired to it's parent window when the button is clicked. How can I do that?

Thanks in advance,

Marcel
 
Forgot to mention, the button should not be disabled or made invisible.

Marcel
 
protected override void OnClick(object sender, MouseEventArgs e)
{
if (mycondition != true)
{
base.OnClick(e);
}
}


Something to that effect written in your custom button.
 
Perfect. A star and thank you, JurkMonkey.

Marcel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top