Binding List

  • Thread starter Thread starter csharpula csharp
  • Start date Start date
C

csharpula csharp

Hello,
I have the following situation: A BindingList (which is binding between
list of object and ListBox) of items. I choose few items from the list
-> press a button and want that the items that been choosen will be
transformed to other list and will be delited from the original
ListBox.My problem is that this action also deletes items from the
objects list. How can I juust copy to binding list and see the change in
ListBox only? Thank you!
 
Well, you could call the CopyTo method, copying the items into an array
and then using that to populate a new List<T>, which you would pass to a new
instance of the BindingList<T>, and then bind to that.

However, this will be a shallow copy, so changes you make in one
instance of the object will be seen in the other list. If that's not an
issue, then this should work.
 

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