Share via


DataConnectionCollection.Item Property (Int32) (Microsoft.Office.InfoPath)

Gets a reference to the specified DataConnection object from the collection by index value.

Namespace: Microsoft.Office.InfoPath
Assembly: Microsoft.Office.InfoPath (in microsoft.office.infopath.dll)

Syntax

'Declaration
Public MustOverride ReadOnly Default Property Item ( _
    index As Integer _
) As DataConnection
'Usage
Dim instance As DataConnectionCollection
Dim index As Integer
Dim value As DataConnection

value = instance(index)
public abstract DataConnection this [
    int index
] { get; }

Parameters

  • index
    The zero-based index of the DataConnection object to get.

Property Value

The zero-based index of the DataConnection object to get.

Remarks

After you have set a reference to the DataConnection object that the Item property returns, you can access any of its properties or methods after the object has been cast to the appropriate type for the corresponding data connection. For example, to access the properties and methods of a data connection for submitting a form in e-mail, you must cast the returned DataConnection object to the EmailSubmitConnection type.

Important

Index value of a given data connection is not guaranteed to be the same between versions, or between sessions of opening the same form template in InfoPath and in a Web browser (from Microsoft Office Forms Server 2007 or from an appropriately configured document library on Office SharePoint Server 2007 running InfoPath Forms Services). To reliably open the same data connection under all conditions, you should open the data connection explicitly by name using the DataConnectionCollection.Item(String) method instead.

This member can be accessed without restrictions.

This type or member can be accessed from code running in forms opened in Microsoft Office InfoPath 2007 or in a Web browser.

Example

In the following example, the first DataConnection object is retrieved from the DataConnectionCollection, and then cast to the EmailSubmitConnection type.

   // Get the first connection from the 
   // DataConnections collection.
   EmailSubmitConnection myEmailSubmitConnection =
      (EmailSubmitConnection)(this.DataConnections[0]);
   ' Get the first connection from the 
   ' DataConnections collection.
   Dim myEmailSubmitConnection As EmailSubmitConnection = _
      DirectCast(Me.DataConnections(0), EmailSubmitConnection)

See Also

Reference

DataConnectionCollection Class
DataConnectionCollection Members
Microsoft.Office.InfoPath Namespace