[thelist] Visual Basic 6.0 - Iterating through Collections....

Anthony Baratta Anthony at Baratta.com
Tue Nov 14 15:57:00 CST 2000


Hey VB-Heads.....

I need a few pointers on iterating through Collections. According to the
documentation, Collection Objects in VB 6 are just like Dictionary Objects in VB
Scripting. However, I can't seem to get the "index" of the targeted item in the
collection.

e.g.

   Dim dictProducts As New Collection

   .... blah blah blah ...

   While Not objDB_RecordSet.EOF
      dictProducts.Add "Item", "Key"
      objDB_RecordSet.MoveNext
   Wend

   .... blah blah blah ...

   For Each CatItem In dictCategory
      ' This will get the "Item" from the Collection
      varFunctName = CatItem
      ' How do I get the "Key"
      ???????????
   Next

Any help would be greatly appreciated. The MS Docs and the books I've poured over the
last 24 hours have completely melted my brain.

-- 
Anthony Baratta
President
KeyBoard Jockeys
                    South Park Speaks Version 3 is here!!!
                       http://www.baratta.com/southpark
                              Powered by Tsunami




More information about the thelist mailing list