XMLNode.ParentNode Property

Definition

Gets a XMLNode object that represents the parent element of the specified XMLNode control.

public:
 property Microsoft::Office::Interop::Word::XMLNode ^ ParentNode { Microsoft::Office::Interop::Word::XMLNode ^ get(); };
public Microsoft.Office.Interop.Word.XMLNode ParentNode { get; }
member this.ParentNode : Microsoft.Office.Interop.Word.XMLNode
Public ReadOnly Property ParentNode As XMLNode

Property Value

A XMLNode control that represents the parent element of the specified XMLNode object.

Examples

The following code example uses the ParentNode property to display the name of the parent node of an XMLNode control. This example assumes that the current document contains an XMLNode named CustomerFirstNameNode.

private void DisplayParentNode()
{
    MessageBox.Show("The parent node of '" +
        this.CustomerFirstNameNode.BaseName + "' is '" + 
        this.CustomerFirstNameNode.ParentNode.BaseName + "'.");
}
Private Sub DisplayParentNode()
    MsgBox("The parent node of '" & Me.CustomerFirstNameNode.BaseName & _
        "' is '" & Me.CustomerFirstNameNode.ParentNode.BaseName & "'.")
End Sub

Remarks

For a root node, the ParentNode property returns null.

Applies to