Assume we have a Combobox
in a winforms application which its items bound to a Bindingsource
.
I need to fire an event when the user changes the selected item in the combobox
.
Should I handle the combobox.selectedindexchanged
event or bindingsource.currentchanged
event. Which is better in case of performance or anything else?
I've searched a lot to find an article or something about it, but can't find something straight and clear. I appreciate any suggestion or workaround.
UPDATE
I need to call a function base on the selected object ID
after user select an Item from combobox
. (ID
is accessible from both Combobox1.SelectedValue
and bindingSource1.Current.ID
). In this case which event shouldI choose?
After all, I am getting to know it should be better to use Combobox.SelectedIndexChanded
event, because I am interacting with a user and looking for a response from UI. Although here the events do the same for me, but Bindingsource.CurrentChanged
event can be used in case I wanted to track the current object changes from anywhere like a list change or something, not exactly the UI. Its better to use combobox
events here I believe.