Share via


XMLNodes.Count Property

Gets a count of the number of XML Document Object Model (DOM) node objects contained in the XMLNodesCollection collection.

Namespace:  Microsoft.Office.Interop.InfoPath
Assembly:  Microsoft.Office.Interop.InfoPath (in Microsoft.Office.Interop.InfoPath.dll)

Syntax

'Declaration
ReadOnly Property Count As Integer
    Get
'Usage
Dim instance As XMLNodes
Dim value As Integer

value = instance.Count
int Count { get; }

Property Value

Type: System.Int32

Examples

In the following example, the Count property is used within a for loop to iterate through the collection of XML DOM node objects returned by the GetSelectedNodes method of the ViewObject object and display a message box indicating the name of each XML DOM node that is contained in the XMLNodes collection:

XMLNodes selectedNodes;
selectedNodes = thisXDocument.View.GetSelectedNodes();
for (int i=0; i < selectedNodes.Count; i++)
{
 thisXDocument.UI.Alert("XML DOM node name: " + selectedNodes[i].nodeName);
}

See Also

Reference

XMLNodes Interface

XMLNodes Members

Microsoft.Office.Interop.InfoPath Namespace