<-- Previous || Up || Next -->

Add Or Update Function
Hash Table Class

Public Function AddOrUpdate( _
      ByVal vKey As Variant _
    , ByVal vItem As Variant _
    ) As Boolean

Add a new definition (Key and Item pair) into the hash table or update an existing Key and Item pair.
Inserting an Item with the same Key as another Item in the table causes the previous Item to be overwritten.

       Dim htTemp As New HashTable
    for example
       htTemp.AddOrUpdate "FunctionName", 23
       htTemp.AddOrUpdate "FunctionName", 24
       htTemp.Count = 1
vKey: The string or numeric identifier associated with the Item vItem.
vItem: Item that will inserted into the hash table along with its identifier (or new Item that will replace the previous Item associated with Key). vItem can be any type of Variant value (vbString, numeric, vbDate, vbObject, vbArray, etc.).
Return value: Method returns True if new Key & Item pair was Added, and returns False if existing Key was Updated with new Item.
See also:
    Add Method
    Update Method
    Lookup Method
    AddFromHashTable Method
v1.3 BugFix: This method has been fixed to support the storage of Object and DataObject type Items.
v1.5 BugFix: Corrected a bug that caused this method to not work correctly in many cases.
v1.5 Change: AddOrUpdate now returns True if the Key & Item pair was Added, and it returns False if an existing Key was Updated with a new Item.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.