Remember to use correct event handler for combobox user changes

I always forget to select the correct event handler when wiring up comboboxes, I think mainly due to the fact that the default handler selected for you by Visual Studio always tends to be SelectedIndexChanged.

You should always use SelectionChangeCommitted if you want to capture user changes for comboboxes – indeed the Microsoft MSDN docs tell you this too – so no real excuses here!

SelectionChangeCommitted is raised only when the user changes the combo box selection. Do not use SelectedIndexChanged or SelectedValueChanged to capture user changes, because those events are also raised when the selection changes programmatically.

You can create a SelectionChangeCommitted event handler to provide special handling for the ComboBox when the user changes the selected item in the list.

Advertisements
Remember to use correct event handler for combobox user changes

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s