Monthly Archives: April 2011

How to remove all event handlers from a control – C# winforms

A few days ago I was stuck in a problem. I was in need of removing certain events from controls that i have on my form. I spend almost 3 hours googling for a suitable code and I found this article in stackoverflow. It helped me alot.

The code I got from there was meant to remove click event from a button. I need to remove double click events from some panels and click events from some buttons. So i made a control extension, which will remove all eventhandlers for a certain event.

Now, the usage of this extenstion.

If you need to remove click events from a button,

If you need to remove doubleclick events from a panel,