C #, is there an OnChange event in a ListBox?

I was looking for something similar, but I could not find it. I want my program to do something when there are any changes in ListBox(for example, changing a selected item, adding a new one, deleting one, etc.)

+3
source share
2 answers

You can use SelectedIndexChanged or SelectedValueChanged .

There are no .NET events to add or remove elements, so you need to implement this functionality yourself. This SO post explains how you can do this.

Good luck

PS: I assumed that you are using Windows Forms

+5
source

ListBox BindingList, BindingLists ListChanged. ListChangedEventArgs ListChangedType, , , , .

.

, , , , , , ListAdded:

ListAdded(this, new ListAddedEventArgs() { List = myList, Item = myItem });
+1

All Articles