0 out of 4 rated this helpful - Rate this topic

Item Method (General Extensibility)

Visual Studio .NET 2003

Returns an indexed member of a collection.

[Visual Basic .NET]
Public Function Item( _
   ByVal index As Object _
) As AddIn
[Visual Basic 6]
Function Item( _
   ByVal index As Variant _
) As AddIn
[C++]
HRESULT __stdcall Item(
   VARIANT index,
   /* [out, retval] */ AddIn** retVal
);
[C#]
public AddIn Item(
   object index
);
[JScript .NET]
public function Item(
   index : Object
) : AddIn

Parameters

Index
Required. The index of the item to return.

Remarks

For most objects, the value passed to Index is an integer that is an index to an object in its collection, such as OutputWindowPanes.Item(4), which equates to an OutputWindow object in the collection. For many objects, though, the value of Index can also be a string value that equates to an object in the collection. For example, if you have an Output window called "My Output Window," rather than referring to it by its index value, you could instead refer to it by its name, such as OutputWindowPanes.Item("My Output Window"). The exact value that is accepted by Item, though, depends upon the collection and its implementation.

Example

Sub ItemExample1()
   ' Closes all saved documents.
   Dim iDoc As Integer
   For iDoc = 1 To DTE.Documents.Count
      If DTE.Documents.Item(iDoc).Saved Then
         DTE.Documents.Item(iDoc).Close()
      End If
   Next iDoc
End Sub

See Also

Applies To: AddIns Collection | Breakpoints Collection | BuildDependencies Collection | CodeElements Collection | Configurations Collection | ContextAttributes Collection | Documents Collection | Expressions Collection | FontsAndColorsItems Collection | Imports Object | IVCCollection Collection | Languages Collection | LinkedWindows Collection | OutputGroups Collection | OutputWindowPanes Collection | Processes Collection | Programs Collection | ProjectItems Collection | Projects Collection | Properties Collection | References Object | SelectedItems Collection | SelectionContainer Object | Solution Object | SolutionConfigurations Collection | SolutionContexts Collection | StackFrames Collection | TaskItems Collection | TextPanes Collection | TextRanges Collection | Threads Collection | ToolBoxItems Collection | ToolBoxTabs Collection | UIHierarchyItems Collection | VCCodeElements Collection | WindowConfigurations Collection | Windows Collection

Did you find this helpful?
(1500 characters remaining)