Add

          Method 
          Member of  Multi.Dictionary 

Description
Add a new key and item to the Dictionary.
Syntax
Dictionary.Add (Key as String, Item as Variant)
 
Where Type Optional Default Description
 Key  String     The key associated with the item being added. 
 Item  Variant     The item associated with the key being added. 
Examples
 Enumerate Multi.Dictionary keys and items  
  Dim D As New Multi.Dictionary
  
  D.UniqueKeys = False
  
  'Fill dictionary with some data
  D("Peter") = 12
  D.Add "Alex", 2534
  D.Add "Alex", 2535
  D.Add "Alex", 14
  
  Dim I As Long, Keys()
  
  'Get dictionary Keys
  Keys = D.Keys
  
  'Loop through Keys array
  For I = 0 To UBound(Keys)
    Debug.Print "Key", I, Keys(I)
  Next

  Dim Items()
  
  'Get dictionary Items
  Items = D.Items
  
  'Loop through Items array
  For I = 0 To UBound(Items)
    Debug.Print "Item", I, Items(I)
  Next


' output:
Key            0            Alex
Key            1            Peter
Item           0             2534 
Item           1             2535 
Item           2             14 
Item           3             12
  Other links for Add
Methods of Dictionary class
Properties of Dictionary class
Free threaded dictionary object. Lets you work with unique/non-unique keys, any VARIANT values and connect to other dictionary in the same process.
     Dictionary is a COM class specially designed as a free-threaded dictionary in Application scope of ASP/ASP.Net pages. It also works with script other engines in VB Script and JScript (ASP,ASP.Net, WSH, CHM, HTA), VB Net, Visual basic (VBA - VB 5, VB 6, Word, Excel, Access, …), C#, J#, C++, ASP, ASP.Net, Delphi and with T-SQL OLE functions - see Use ByteArray object article. You can also use the object in other programming environments with COM support, such is PowerBuilder.
     Source code for Dictionary is available within distribution license, please see License page for Multi Dictionary or License page for ScriptUtilities and Huge ASP file upload.
Multithreaded dictionary object. Lets you work with unique/non-unique keys in VBA/VBS/ASP/WHS envinronment (share application/session variables in ASP)

© 1996 – 2005 Motobit Software, help{at}pstruh.cz, help v. 2.16.14