by Yuening Dai (30 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 9th January 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Sample to Use Dictionary Object in VB6
'You need to have reference to Microsoft Scripting Runtime first.
'Put a ListBox on your form to accept the result.
'The following code illustrates how to create a Dictionary object:
'
Dim a
Dim d
'
Set d = CreateObject("Scripting.Dictionary")
d.Add "a", "Athens" 'Add some keys and items
d.Add "b", "Belgrade"
d.Add "c", "Cairo"
d.Add "d", "Detroit"
d.Add "e", "Emory"
d.Add "f", "Fairfax"
'
a = d.Items 'Get the items
'
For I = 0 To d.Count - 1 'Iterate the array
List1.AddItem a(I)
Next
'