3
Answers

SelectedIndexChanged in WinFrms databind Listbox

rulec444

rulec444

20y
3.8k
1
I am having a problem with coding the SelectedIndexChange event on a listbox that's bound to data from a database. When I code the SelectedIndexChange event, it is fired when the listbox is populated with the data from the database, which results in a never ending loop and the application gets stuck. I really only want the event to fire when the user selects an item from the listbox, not when it is filled. I also tried SelectedValueChanged and this does the same thing. The combobox has a SelectionChangeCommitted event which works for that but the listbox doesn't have this. Are there any tricks around this? Thanks for your help.
Answers (3)