IHTMLTxtRangeCollection::item Method

Retrieves an object from a TextRange collection.

Syntax

HRESULT item(
    VARIANT *pvarIndex,
    VARIANT *pvarResult
);

Parameters

  • pvarIndex
    [in] Pointer to a VARIANT of type VT_I4 or VT_BSTR that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made.
  • pvarResult
    [out, retval] Pointer to a VARIANT of type VT_DISPATCH containing an IDispatch interface pointer that represents a single object or a collection of objects if successful, otherwise NULL.

Return Value

Returns one of the following values.

S_OK The operation was successful.
DISP_E_MEMBERNOTFOUND The specified object was not found.

Remarks

Always check the IDispatch pointer returned by this call, even if the method returns S_OK. If the value of the pointer is NULL, the element was not found and the call was not successful.

Upon successful return, the pvarResult parameter contains an IDispatch interface pointer or an array of IDispatch interface pointers that can be queried for a specific interface, depending on the collection type.

IHTMLTxtRangeCollection::item returns a VARIANT of type VT_DISPATCH that can be queried for IHTMLTxtRange.

Microsoft Internet Explorer 5 does not provide multiple selection. The default implementation of this method returns a collection consisting of a single TextRange object

Host applications can provide a multiple selection mechanism and can return a collection of TextRange objects that represents discontinuous selections.