Kurt
Kurt

Reputation:

C# Combo box value change, what Event should I use to write update the registry?

I have a read only combo-box with 5 values in, when the user selects a new value what event should I use to write that value to the registry?

Thanks

Upvotes: 10

Views: 29744

Answers (4)

Randima Dilshan
Randima Dilshan

Reputation: 1

You can Use this event. "SelectionChangeCommitted"

private void ChangedCommitted_Click(object sender, EventArgs e) {
enter code here }

Upvotes: 0

John
John

Reputation: 1

How about if you are using the DateTimePicker? This does not have the SelectionChangeCommitted value.

Upvotes: -3

Patrick
Patrick

Reputation: 17973

I usually use the SelectedIndexChanged event to check when a user selects a value in a combobox

Upvotes: 1

Quintin Robinson
Quintin Robinson

Reputation: 82335

Well regardless of what you will end up doing with the value when selected, it is safe to use the SelectionChangeCommitted event.

Here is a little follow up info on this event vs the other commonly used events. (from MSDN)

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.

Upvotes: 24

Related Questions