Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handle Click Event on Item in a ComboBox

Does anyone know of any event or sequence of events to be able to handle when a user clicks an item in a ComboBox? Currently the only events that I see being fire from ComboBox within WinForms is SelectedIndexChanged or SelectedValueChanged. The problem with these events is that they are also fired under many other scenerios such as when the user presses up or down arrow (even if the ComboBox is not open).

ComboBox.SelectedIndexChanged += (o, e) => Console.WriteLine("ComboBox_SelectedIndexChanged");
ComboBox.SelectedValueChanged += (o, e) => Console.WriteLine("ComboBox_SelectedValueChanged");

Any thoughts?

like image 627
Scott White Avatar asked Nov 08 '10 16:11

Scott White


1 Answers

If you are asking about when the user clicks an item in the ComboBox to select it, you can use the ComboBox.SelectionChangeCommitted event.

like image 140
Jeff Ogata Avatar answered Mar 04 '23 19:03

Jeff Ogata