Updating a property of an Object within a collection of Objects

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there any way to do this without removing the object and then re-adding it
with the updated property.

Public Structure Blob
Public f1 as String
Public f2 as Boolean
End Structure

I then have a collection of Blobs defined and add 5 elements to the
collection. I then want to be able to loop through the collection and
possibly change the f2 flag to true in certain situations.
 
KenRoy,

You can change the Boolean in the same place. You never can change a string
in the same place.
However why bother about that?

Cor
 
Hi!

Try:

For each o as Blob in oBlobColl
if o.f1="Charly" then o.f2=true
next

HTH

Wolfgang
 
I error out when I try to use the following logic:
Dim b as blob
Dim blobs as New Collection

b.f1="A"
b.f2=False
blobs.Add(b)
b.f1="B"
b.f2=False
blobs.Add(b)
b.f1="C"
b.f2=False
blobs.Add(b)

blobs(2).f2=True
 
Back
Top