Function Hash Table Class

Lookup

Lookup and return the Item associated with a Key .

Signature (Visual Basic / VBA)

Public Function Lookup( _
      ByRef rItem As Variant _
    , ByVal vKey As Variant _
    ) As Boolean

Code Example

    Assuming
       Dim htTemp As New HashTable
       htTemp.Add "FunctionName", 23
       htTemp.Add "FunctionName", 24
       Dim varData As Variant
       Dim bResult As Boolean
    for example
       bResult = htTemp.Lookup(varData, "FunctionName")
    leaves
       bResult = True
       varData = 24

Parameters

Parameter Description
rItem The Item that will be returned if the lookup is successful. rItem can be any data type (vbString, numeric, vbDate, vbObject, vbArray, etc.) as long as it is compatible with the Item to be returned. It is frequently wisest to use a Variant since they can accept any type of Item .
vKey The string or numeric identifier whose Item is to be returned.

Return Value

Method returns True if the Key was found and its Item was returned via rItem, and it returns False otherwise.

Notes & Version History

Note If there are multiple hash table definitions with the same Key , this method will return the Item from the one that was mostly-recently-added, assuming that the hash table has not been expanded nor contracted.
v1.3 BugFix This method has been fixed to support the retrieval of Object and DataObject type Items .