GetItem Method
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

UIHierarchy.GetItem Method

Gets the item designated by given path.

Namespace: EnvDTE
Assembly: EnvDTE (in envdte.dll)

UIHierarchyItem GetItem (
	[InAttribute] string Names
UIHierarchyItem GetItem (
	/** @attribute InAttribute() */ String Names
function GetItem (
	Names : String
) : UIHierarchyItem



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

A UIHierarchyItem object.

The path comprises 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.


For details on another way to access nodes in a UIHierarchy, see UIHierarchy object.

Sub GetItemExample()
   Dim UIH As UIHierarchy = _
   Dim UIHItem As UIHierarchyItem = UIH.GetItem("Macros\Samples")

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