XDocuments2.Item Property (Object)

Gets a reference to the specified XDocument object from the collection.

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

Syntax

'Declaration
ReadOnly Default Property Item ( _
    varIndex As Object _
) As XDocument
    Get
'Usage
Dim instance As XDocuments2
Dim varIndex As Object
Dim value As XDocument

value = instance(varIndex)
XDocument this[
    Object varIndex
] { get; }

Parameters

  • varIndex
    Type: System.Object

    An expression that specifies the position of a member of the XDocumentsCollection. If a numeric expression, the argument must be a number from 0 to the value of the Count minus 1. If a string expression, the argument must be the Uniform Resource Locator (URL) path of a member of the collection.

Property Value

Type: Microsoft.Office.Interop.InfoPath.SemiTrust.XDocument

Implements

XDocuments.Item[Object]

Remarks

If the value provided for the varIndex argument does not match any existing member of the collection, an error occurs.

After you have set a reference to the XDocument object that the Item property returns, you can access any of its properties or methods.

Important

This member can be accessed without restrictions.

Examples

Because the Item property is the default property of the XDocumentsCollection collection, it can be used as follows:

XDocument firstDocument;
firstDocument = thisApplication.XDocuments[0];

You can use the name of the XDocument as the argument to the Item method, as shown in the following example:

XDocument myFormDocument;
myFormDocument = thisApplication.XDocuments[@"C:\MyForm.xml"];

See Also

Reference

XDocuments2 Interface

XDocuments2 Members

Item Overload

Microsoft.Office.Interop.InfoPath.SemiTrust Namespace