Item Property (DataAdapters Collection)

A read-only property that returns a reference to the specified data adapter object from the DataAdaptersCollection collection, based on position or name.

expression.Item(ByVal varIndex As Variant) As Object

expression Required. An expression that returns a reference to the DataAdapters collection.

varIndex Required Variant. An expression that specifies the position of a member of the DataAdapters collection. If the argument is a numeric expression, it must be a number from 0 to the value of the collection's Count property minus 1. If the argument is a string expression, it must be the name of a member of the collection.

returns A reference to a data adapter object.

Security Level

0: Can be accessed without restrictions.

Remarks

Note  This object model member is not supported when the Disable Service Pack features option on the Advanced tab of the Options dialog box in InfoPath is selected or when Microsoft Office 2003 Service Pack 1 or later is not installed. Any form that implements this object model member in its code will generate an error message if it is opened in InfoPath when service pack features are disabled or unavailable.

Example

In the following example, the Item property of the DataAdapters collection is used to return a reference to a data adapter in the collection:

var objDataAdapter;
objDataAdapter = XDocument.DataAdapters.Item(0);

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

var objDataAdapter;
objDataAdapter = XDocument.DataAdapters(0);

You can also use the name of a data adapter as the argument to the Item method, as shown in the following example:

var objDataAdapter;
objDataAdapter = XDocument.DataAdapters("MyDataAdapter");

Applies to | DataAdapters Collection