Loop through a collection

  • Thread starter Thread starter Fresno Bob
  • Start date Start date
F

Fresno Bob

I want to loop through a collection of objects in a for each loop and change
the value of one of the properties of the objects. When I go to bind to my
gridview the values haven't changed. How I solve this? I am guessing it is
something to do with reference vs value types but I am not quite sure. I
will be using vb.net regards. Chris.
 
make sure u modify the same instance of object that you are binding to
grid view....
it will easy to figure out wats going wrong if u can post the code.

~Sulabh
 
make sure u modify the same instance of object that you are binding to
grid view....
it will easy to figure out wats going wrong if u can post the code.

~Sulabh

For Each obj As CustomTypes.Customers In col
obj.id = intTmp
Next

All the objects in col don't have the new id value when I do the bind
to a gridview
 
I guess that GridView finishes its data binding jobs before you change
values. You may explicit call GridView's DataBind method.
 
Back
Top