HighTechTalks DotNet Forums  

How to Update an item in a BindingList?

Dotnet Academic General Discussions microsoft.public.dotnet.academic


Discuss How to Update an item in a BindingList? in the Dotnet Academic General Discussions forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
=?Utf-8?B?RWl0YW4=?=
 
Posts: n/a

Default How to Update an item in a BindingList? - 08-24-2007 , 01:24 PM






Please look at the code and the following question...

public BindingList<MyStruct> myList ;

foreach ( Object item in myList )
{
MyStruct myStruct = (MyStruct)item;
myStruct .Name = "any new name" ;

///
/// Question: I need to update myList with the updated myStruct.
/// What is the most efficient way to
/// replace/update the old item in the list
}

Thanks
EitanB



Reply With Quote
  #2  
Old   
PvdG42
 
Posts: n/a

Default Re: How to Update an item in a BindingList? - 08-29-2007 , 07:42 AM






"Eitan" <Eitan (AT) discussions (DOT) microsoft.com> wrote

Quote:
Please look at the code and the following question...

public BindingList<MyStruct> myList ;

foreach ( Object item in myList )
{
MyStruct myStruct = (MyStruct)item;
myStruct .Name = "any new name" ;

///
/// Question: I need to update myList with the updated myStruct.
/// What is the most efficient way to
/// replace/update the old item in the list
}

Thanks
EitanB


Are you sure that BindingList is the collection type you need? If you're
using it to store instances of a structure you created, and not for it's
data binding capabilities, one of the other collection types may be better,
depending on your needs (unstated).
Read here for methods/properties that support updating...

http://msdn2.microsoft.com/en-us/library/ms132679.aspx

http://msdn2.microsoft.com/en-us/library/ms132680.aspx



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.