0

I have problem in C#.

I have a list box and a class called FileManager. FileManager contains, a method called ValidateFile which validate and valid files need to add to a list in the FileManager class.

I want to add contents of list to my list box. And I am just running through the list and adding to my listbox.

Since, ValidateFile in FileManager Class takes little more time and to keep my UI live, I am calling ValidateFile method on a Delegate.

But I am searching for good way to populate my listbox when FileManager.List changes or for any change in the list should reflect in my listbox.

please post code or web links if you have.

Thank you, harsha

tzup
  • 3,566
  • 3
  • 26
  • 34
Harsha
  • 1,861
  • 7
  • 28
  • 56
  • How does your FileManager.List change? Is it changed by the user? Also, is this a desktop app or web app? – tzup Mar 07 '11 at 07:06
  • Better design can be suggested if we know how FileManager.List works. Not sure if this would fit, so adding it as a comment, you may add a FileChange Event Handler and update the list there. This way, the change will only be invoked when a change in file content occurs. – Shamim Hafiz - MSFT Mar 07 '11 at 07:07

1 Answers1

1

I believe you're interested in the ObservableCollection<T> class, see MSDN.

neontapir
  • 4,698
  • 3
  • 37
  • 52
  • I am using now AsyncBindingList from //For more information refer: http://windowsclient.net/articles/asyncbindinglist.aspx – Harsha Mar 08 '11 at 05:45