FirstSibling Property
Collapse the table of content
Expand the table of content

Visual Basic: Windows Controls

Visual Studio 6.0

FirstSibling Property

See Also    Example    Applies To

Returns a reference to the first sibling of a Node object in a TreeView control.



The object placeholder represents an object expression that evaluates to an object in the Applies To list.


The first sibling is the Node that appears in the first position in one level of a hierarchy of nodes. Which Node actually appears in the first position depends on whether or not the Node objects at that level are sorted, which is determined by the Sorted property.

The Child, FirstSibling, LastSibling, Previous, Parent, Next, and Root properties all return a reference to another Node object. Therefore you can simultaneously reference and perform operations on a Node, as follows:

With TreeView1.Nodes(x).FirstSibling
   .Text = "New text"
   .Key = "New key"
   .SelectedImage = 3
End With

You can also set an object variable to the referenced Node, as follows:

Dim NodFirstSib As Node
' Get a reference to the first sibling of Node x.
Set NodFirstSib = TreeView1.Nodes(x).FirstSibling
' Use this reference to perform operations on the first sibling Node.
With nodFirstSib
   .Text = "New text"   '  Change the text.
   .Key = "New key"   ' Change key.
   .SelectedImage = 3   ' Change SelectedImage.
End With
© 2016 Microsoft