Root Property (Node Object)

       

Returns a reference to the root Node object of a selected Node.

Syntax

object.Root

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

Remarks

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).Root
   .Text = "New text"
   .Key = "New key"
   .SelectedImage = 3
End With

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

Dim NodRoot As Node
' Get a reference to the root of Node x.
Set NodRoot = TreeView1.Nodes(x).Root
' Use this reference to perform operations on the root Node.
With nodRoot
   .Text = "New text"   '  Change the text.
   .Key = "New key"   ' Change key.
   .SelectedImage = 3   ' Change SelectedImage.
End With