Utility components Key
Read only indexed property. Retrieves the key name corresponding to the passed index or name.


variable = object.Key(key_or_index)

IDL definition:

[propget, id(3), helpstring("property Key")] HRESULT Key([in] VARIANT VarKey, [out, retval] VARIANT *pVal);


object - Previously created VarDictionary object

variable - variable that will receive the key name

key_or_index - numeric or string value specifying an item index (1-based) or key name


var name = vardict.Key(3)
var name2 = vardict.Key("Item 3")

Dim name,name2
name = vardict.Key(3)
name2 = vardict.Key("Item 3")


If the key_or_index passed to the property is a string. Then the property returns the same string if it names an item in the collection.

If the key_or_index is not found error "Key not found" will be generated. The same is true if the collection allows unnamed items (see  allowUnnamedValues).

Applies to: VarDictionary

See also: Item property, Add method


newObjects Copyright 2001-2005 newObjects [ ]