Dictionary.Add Method (VB6) |
Named Arguments
Yes
Syntax
dictionaryobject.Add key, item
dictionaryobject
Use: Required
Data Type: Dictionary object
A reference to a Dictionary object.
key
Use: Required
Data Type: String
A key value that's unique in the Dictionary object.
item
Use: Required
Data Type: Object
The item to be added to the dictionary.
Description
Adds a key and its associated item to the specified Dictionary object.
Rules at a Glance
If the key isn't unique, runtime error 457, "This key is already associated with an element of this collection," is generated.
item can be of any data type, including objects and other Dictionary objects.
Example
Set oDict = New Dictionary iVal = 1 Set oTest = New clsTest With oTest .Age = 10 .Phone = "0112 31234" .TestName = "Russell" End With oDict.Add CStr(iVal), oTest Set oTest = Nothing
Get VB & VBA in a Nutshell: The Language now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.