Remove eventHandler that was added using lambda expression

Viewed 2758

I have a control that I added an event to. However, I needed to pass some extra parameters to the event method, so I use lambda expression like it was described here:

Pass parameter to EventHandler

comboBox.DropDown += (sender, e) => populateComboBox(sender, e, dataSource, selectedItem);

But this event should only fire the first time the conditions are met after what it should be removed.

Doing this doesn't work:

comboBox.DropDown -= (sender, e) => populateComboBox(sender, e, dataSource, selectedItem);

So the question is, is there a way to remove this method?

I've seen this:

How to remove all event handlers from a control

But I can't get it working for ComboBox DropDown event.

1 Answers
Related