Friday, April 24, 2009

System.Windows.Forms.ComboBox user changes selection event

Recently I found a very exciting thing in System.Windows.Forms.ComboBox that I want to share.

There is a special event for handling selection changes done by user.
If you want to capture user changes do not use SelectedIndexChanged or SelectedValueChanged events, cause those events are also raised when the selection changes programmatically.

SelectionChangeCommitted is raised only when the user changes the combo box selection.

On selection change ComboBox fire event in the following order: ComboBox.ChangeCommitted > ComboBox.ValueChanged > ComboBox.IndexChanged

1 comment:

Jason Harris said...

This post was a huge help to me - I was struggling with SelectedIndexChanged and your post alleviated my problem!

Thanks.