Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Parent Property (Node Object)
Returns or sets the parent object of a Node object. Available only at run time.
Syntax
object.Parent[ = node]
The Parent property syntax has these parts:
| Part | Description |
| object | An object expression that evaluates to an object in the Applies To list. |
| node | A Node object that becomes the parent of the object. |
Remarks
At run time, an error occurs if you set this property to an object that creates a loop. For example, you cannot set any Node to become a child Node of its own descendants.
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).Parent
.Text = "New text"
.Key = "New key"
.SelectedImage = 3
End With
You can also set an object variable to the referenced Node, as follows:
Dim NodParent As Node
' Get a reference to the parent of Node x.
Set NodParent = TreeView1.Nodes(x).Parent
' Use this reference to perform operations on the Parent Node.
With nodParent
.Text = "New text" ' Change the text.
.Key = "New key" ' Change key.
.SelectedImage = 3 ' Change SelectedImage.
End With