Reputation: 111
I need to working with combobox SelectedIndexChanged event, but in some cases I want when click button cancel SelectedIndexChanged event or code related to this event stop working ?
Upvotes: 0
Views: 5131
Reputation: 6079
SelectedIndexChanged
as told by @RamashankarUpvotes: 1
Reputation: 1658
ComboBox comboBox = new ComboBox();
Subscribe to SelectedIndexChanged event
comboBox.SelectedIndexChanged += comboBox_SelectedIndexChanged;
Use below code to unsubscribe the SelectedIndexChanged event
comboBox.SelectedIndexChanged -= comboBox_SelectedIndexChanged;
Upvotes: 4
Reputation: 73502
There are number of options
Upvotes: 1
Reputation: 760
You can unsubscribe the events like the below upon clicking on the button:
combo1.SelectedIndexChanged -= combo1_SelectedIndexChanged;
Upvotes: 0