Search code examples
c#combobox

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


Solution

  • 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.