ListBox.Items change event?

  • Thread starter Thread starter Michael A. Covington
  • Start date Start date
M

Michael A. Covington

Is there an event that can be set to trigger automatically whenever there is
any addition, deletion, or rearrangement of the Items of a ListBox?
 
Perhaps your best bet is to use data-binding, and set the DataSource
to something that *does* offer this (via IBindingList) -
BindingList<T> perhaps for objects, or DataTable for DataRows. The
ListChanged event of IBindingList should give what you need.

Marc
 
Michael said:
Is there an event that can be set to trigger automatically whenever there is
any addition, deletion, or rearrangement of the Items of a ListBox?

Not that I'm aware of. But there are collection types that do provide
events for changes, I believe, and you could bind such a collection to
the ListBox as its data source. Then you'd make changes to the ListBox
through that collection, subscribing to its events for change notification.

Whether that would work in your case, I can't say. But it's a thought. :)

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top