There seems to be a problem with the .Net Combobox control ! Microsoft is stating it isn’t actually a real problem, but still it is something a programmer should know and if needed take care of.
Let me first explain the problem… If you use the mouse to open a combobox, but then use the arrow keys to navigate in the list and change focus with the tab key, the combobox will select the highlighted value, but will NOT trigger the SelectionChangeCommited event !!
So in other words, even though the programmes subscribes to this event to know when a user has selected a value, the program will not notice it.
According to this post : http://weblogs.asp.net/grobinson/archive/2005/09/21/425711.aspx, Microsoft is aware of this and regards it as standard behaviour. So we are left with the only option to write a workaround ourselves.
I’ve found a good starting solution here : https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3409311&SiteID=1, but I think this can be improved ! Because with this given solution, if a user still would use the mouse to select an item we would get the SelectionChangeCommited event twice.
So the workaround is to suppress the base event and only trigger our own. Here is the code…
public class DropdownBox : ComboBox
private object m_InitialValue = null;
private void DropdownBox_DropDown(object sender, EventArgs e)
this.m_InitialValue = this.SelectedItem;
private void DropdownBox_DropDownClosed(object sender, EventArgs e)
if (ReferenceEquals(this.SelectionChangeCommitted, null)) return;
if (this.m_InitialValue != this.SelectedItem)
protected override void OnSelectionChangeCommitted(EventArgs e)
public new event EventHandler SelectionChangeCommitted;
protected virtual void FireSelectionChangeCommitted(EventArgs e)
EventHandler cpy = SelectionChangeCommitted;
if (!ReferenceEquals(cpy, null))
[tags]SelectionChangeCommitted, combobox, c#[/tags]