Link to home
Start Free TrialLog in
Avatar of dvplayltd
dvplayltdFlag for Bulgaria

asked on

How to edit collection variable in VB6 ?

Hi experts!


I’m using collection in VB6.
  Set cAppSet = New Collection

  cAppSet.Add 1, sAPP_HARMONY

But my question is how can I later correct value of this collection ?
I try with
cAppSet(sAPP_HARMONY) = 0

give error, then I try first to delete it and add again, it work, but when I try to access collection I get error.
cAppSet.Remove sAPP_HARMONY
  cAppSet.Add 1, sAPP_HARMONY

and when make
If cAppSet(sAPP_HARMONY) Then

I get error
Object is not longer valid

So – how can I edit collection value ?
Avatar of rogerard
rogerard
Flag of United States of America image

You need to reference as

cAppSet.Item(sAPP_HARMONY) = 0
I believe you might also be able to reference it:
cAppSet.Item!sAPP_HARMONY = 0
Sorry, this
cAppSet!sAPP_HARMONY = 0
ASKER CERTIFIED SOLUTION
Avatar of Dana Seaman
Dana Seaman
Flag of Brazil image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dvplayltd

ASKER

10x. I know Dictinary object from C# and I'm glad it is present in VB6. Thanks !