共用方式為


XMLNode.Parent Property

Definition

Gets a Document that represents the document containing the specified XMLNode control.

public:
 property System::Object ^ Parent { System::Object ^ get(); };
public object Parent { get; }
member this.Parent : obj
Public ReadOnly Property Parent As Object

Property Value

A Document that represents the document containing the specified XMLNode control.

Examples

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

private void DisplayParentName()
{
    Word.Document document1 =
        (Word.Document)this.CustomerNode.Parent;

    MessageBox.Show("The parent of '" + this.CustomerNode.BaseName +
        "' is named " + document1.Name);
}
Private Sub DisplayParentName()
    Dim document1 As Word.Document = _
        CType(Me.CustomerNode.Parent, Word.Document)
    MsgBox("The parent of '" & Me.CustomerNode.BaseName & _
        "' is named " & document1.Name)
End Sub

Applies to