Udostępnij za pośrednictwem


XMLNode.LastChild Property (2007 System)

Gets a XMLNode object that represents the last child node of the Microsoft.Office.Tools.Word.XMLNode control.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property LastChild As XMLNode
'Usage
Dim instance As XMLNode 
Dim value As XMLNode 

value = instance.LastChild
[BrowsableAttribute(false)]
public XMLNode LastChild { get; }
[BrowsableAttribute(false)]
public:
property XMLNode^ LastChild {
    XMLNode^ get ();
}
public function get LastChild () : XMLNode

Property Value

Type: XMLNode

Remarks

Use the FirstChild property to access the first child node.

Examples

The following code example uses the LastChild property to display the name of the last child node of an XMLNode control. The example also uses the HasChildNodes property to determine whether the XMLNode control has any child nodes. This example assumes that the current document contains an XMLNode named CustomerNode.

Private Sub DisplayLastChildName()
    If Me.CustomerNode.HasChildNodes Then
        MsgBox("The last child of '" & Me.CustomerNode.BaseName & _
            "' is '" & Me.CustomerNode.LastChild.BaseName & "'.")
    Else
        MsgBox("'" & Me.CustomerNode.BaseName & _
            "' has no child nodes.")
    End If 
End Sub
private void DisplayLastChildName()
{
    if (this.CustomerNode.HasChildNodes)
    {
        MessageBox.Show("The last child of '" + 
            this.CustomerNode.BaseName + "' is '" +
            this.CustomerNode.LastChild.BaseName + "'.");
    }
    else
    {
        MessageBox.Show("'" + this.CustomerNode.BaseName + 
            "' has no child nodes.");
    }
}

.NET Framework Security

See Also

Reference

XMLNode Class

XMLNode Members

Microsoft.Office.Tools.Word Namespace