I have a combobox in a Windows Forms project with an event attached to the selectedindex changed event. The event is getting triggered when the selectedindex is changed both from code and from user input. How do you detect if the selectedindex is getting changed due to user input?
Can you use the SelectionChangeCommitted event instead?
SelectionChangeCommitted is raised only when the user changes the combo box selection
EDIT: The SelectionChangeCommitted event has a major failing: if you use F4 to drop down the list then mouse over your selection and use the Tab key to go to the next control, it does not fire.
There's a [closed and deleted] bug on Connect about it, which suggests using the DropDownClosed
event as well to catch this edge case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With