Monthly Archives: October 2021

Remove all event handlers from an event in C#

I found this technique on this Microsoft forum. When you click the program’s Add button, the following code installs several event handlers. private void btnAdd_Click(object sender, EventArgs e) { btnClickMe.Click += btnClickMe_Click; picCanvas.Click += picCanvas_Click; picCanvas.MouseClick += picCanvas_MouseClick; picCanvas.MouseDown += … Continue reading

Posted in events | Tagged , , , , , , | Comments Off on Remove all event handlers from an event in C#