Printer Friendly Version      Send     
Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
Reference
XMLNode Class
XMLNode Properties
 LastChild Property
This page is specific to
Microsoft Visual Studio 2005/.Net Framework 2.0

Other versions are also available for the following:
Word Object Model Reference (Visual Studio Tools for Office)
XMLNode.LastChild Property

Gets a Microsoft.Office.Interop.Word.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 (in microsoft.office.tools.word.dll)

Visual Basic (Declaration)
Public ReadOnly Property LastChild As XMLNode
Visual Basic (Usage)
Dim instance As XMLNode
Dim value As XMLNode

value = instance.LastChild
C#
public XMLNode LastChild { get; }

Use the FirstChild property to access the first child node.

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.

Visual Basic
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
C#
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.");
    }
}
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker