共用方式為


XMLNodes.Item[Int32] Property

Definition

Gets the XMLNode at the specified index.

public:
 property Microsoft::Office::Interop::Word::XMLNode ^ default[int] { Microsoft::Office::Interop::Word::XMLNode ^ get(int Index); };
public Microsoft.Office.Interop.Word.XMLNode this[int Index] { get; }
member this.Item(int) : Microsoft.Office.Interop.Word.XMLNode
Default Public ReadOnly Property Item(Index As Integer) As XMLNode

Parameters

Index
Int32

Indicates the position of the node that you want to retrieve.

Property Value

The XMLNode at the specified index.

Examples

The following code example uses the Item[] property to get the first Microsoft.Office.Interop.Word.XMLNode in an XMLNodes collection. The example uses the Item[] property implicitly when a specific index of the collection is specified. This example assumes that the current document contains an XMLNodes control named SampleInsertNodes.

private void DisplayNodeName()
{
    Word.XMLNode node1 = this.SampleInsertNodes[1];
    MessageBox.Show(node1.BaseName);
}
Private Sub DisplayNodeName()
    Dim node1 As Word.XMLNode = Me.SampleInsertNodes(1)
    MsgBox(node1.BaseName)

End Sub

Remarks

The Item[] property returns a Microsoft.Office.Interop.Word.XMLNode object rather than a Microsoft.Office.Tools.Word.XMLNode control. For more information, see Programmatic Limitations of Host Items and Host Controls.

Applies to