Dictionary Collection : Add Method |
An error occurs if the key already exists.
The following example illustrates the use of the Add method.
Adding an item to the Dictionary (JScript) | Copy Code |
---|---|
var d; d = new ActiveXObject("Scripting.Dictionary"); d.Add("a", "Athens"); d.Add("b", "Belgrade"); d.Add("c", "Cairo"); |
Adding an item to the Dictionary (Visual Basic) | Copy Code |
---|---|
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" |