Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Cut
Run
Expand Minimize

GetItem Method

Visual Studio .NET 2003

Returns the item designated by given path.

[Visual Basic .NET]
Public Function GetItem( _
   ByVal Names As String _
) As UIHierarchyItem
[Visual Basic 6]
Function GetItem( _
   ByVal Names As String _
) As UIHierarchyItem
[C++]
HRESULT __stdcall GetItem(
   BSTR Names,
   /* [out, retval] */ UIHierarchyItem** retVal
);
[C#]
public UIHierarchyItem GetItem(
   string Names
);
[JScript .NET]
public function GetItem(
   Names : String
) : UIHierarchyItem

Parameters

Names
Required. The names in order from the root leading to subsequent subnodes. The last name in the array is the node returned as a UIHierarchyItem Object.

Return Value

Returns a UIHierarchyItem object.

Remarks

The path is comprised of node names separated by backslashes (\). If two backslashes are adjacent to one another, they are parsed as a single backslash character that is part of a node name and not a separator.

Note   There is another way to access nodes in a UIHierarchy. For details, see UIHierarchy object.

Example

Sub GetItemExample()
   Dim UIH As UIHierarchy = _
     DTE.Windows.Item(Constants.vsWindowKindMacroExplorer).Object
   Dim UIHItem As UIHierarchyItem = UIH.GetItem("Macros\Samples")

   UIHItem.Select(vsUISelectionType.vsUISelectionTypeSetCaret)
   If UIHItem.IsSelected = False Then
      If UIH.UIHierarchyItems.Expanded = True Then
         MsgBox("Node is expanded.")
      Else
         MsgBox("Node is not expanded.")
      End If
   End If
   UIH.SelectDown(vsUISelectionType.vsUISelectionTypeSelect, 2)
   UIH.DoDefaultAction()
   UIH.SelectDown(vsUISelectionType.vsUISelectionTypeSelect, 1)
   UIH.SelectUp(vsUISelectionType.vsUISelectionTypeExtend, 1)
End Sub

See Also

Manipulating Tree Views Using UIHierarchy

Applies To: UIHierarchy Object

Show:
© 2015 Microsoft