locked
Detecting When a List or Array Item is Modified

    Question

  • I have Properties in my VB.NET classes that are Lists or arrays. I need to know when an item is added to or modified in these Properties. For non-collection properties, I would simply use the Set method, but because doing things like calling the Add method or setting the value at a specific index does not use the Set method, how can I detect when an item is added or changed? Thanks.

    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Saturday, May 17, 2014 1:57 AM

Answers

All replies

  • Use a collection class such as ObservableCollection<T> which supports INotifyPropertyChanged and listen for the CollectionChanged or PropertyChanged events.
    Saturday, May 17, 2014 3:15 AM
    Owner
  • That's right! I always seem to forget about the ObservableCollection for some reason. Thanks.

    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Saturday, May 17, 2014 8:38 PM