Utility components Item
Default, read (write - from version 1.1) indexed property. Retrieves/sets the item corresponding to the passed key name or index.

Syntax:

variable = object.Item(key_or_index)
variable = object.Item
variable = object(key_or_index)
variable = object
object.Item(key_or_index) = variable
object(key_or_index) = variable

IDL definition:

[propget, id(DISPID_VALUE), helpstring("returns the indexed item")] 
    HRESULT Item([in,optional] VARIANT varIndex, [out, retval] VARIANT *pVal);
[propput, id(DISPID_VALUE), helpstring("sets (if allowed) the indexed item")] 
    HRESULT Item([in,optional] VARIANT varIndex, [in] VARIANT varVal);

Parameters:

object - Previously created VarDictionary object

variable - variable that will receive the item

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

Examples:

var item = vardict(3)
var item2 = vardict.Item("Item 3")

Dim item,item2
item = vardict.Item(3)
item2 = vardict("Item 3")

Remarks:

Assignment is allowed only if the itemsAssignmentAllowed property is set to true. If the collection is passed to a script from a component, then the component should set this property to the desired value. Item assignment acts like the Set method - see its page for details.

If the key_or_index passed to the property is not found in the collection value previously set through the Missing property will be returned.

key_or_index is optional and if omitted value previously set through the Root property will be returned.

If Missing and Root properties are not set VT_NULL will be used.

If the collection allows duplication of the item names, then the first item with the name passed will be returned (see allowDuplicateNames).

Applies to: VarDictionary

See also: Add method, Root property, Missing property, Set, itemsAssignmentAllowed

 

newObjects Copyright 2001-2005 newObjects [ ]