Microsoft® Visual Basic® Scripting Edition
Add Method (Dictionary)
 Scripting Run-Time Reference 
Version 2 

See Also                    Applies to


Description
Adds a key and item pair to a Dictionary object.
Syntax
object.Add key, item

The Add method has the following parts:

Part Description
object Required. Always the name of a Dictionary object.
key Required. The key associated with the item being added.
item Required. The item associated with the key being added.

Remarks
An error occurs if the key already exists.

The following example illustrates the use of the Add method:

Dim d                   ' Create a variable.
Set d = CreateObject("Scripting.Dictionary")
d.Add "a", "Athens"     ' Add some keys and items.
d.Add "b", "Belgrade"
d.Add "c", "Cairo"