次の方法で共有


DataSourceCollection.Item Property (Int32)

Gets a reference to the specified DataSource object from the DataSourceCollection 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 DataSource
    Get
'Usage
Dim instance As DataSourceCollection
Dim index As Integer
Dim value As DataSource

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

Parameters

  • index
    Type: System.Int32

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

Property Value

Type: Microsoft.Office.InfoPath.DataSource
The DataSource object for the specified index value.

Remarks

The number or numeric expression passed as the argument for index must evaluate to a number from 0 to the value of the Count property minus 1.

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

This member can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

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

Examples

In the following example, the first DataSource object in the DataSourceCollection of the form template is retrieved by index value and assigned to a variable.

DataSource firstDataSource = this.DataSources[0];
Dim firstDataSource As DataSource = Me.DataSources(0)

See Also

Reference

DataSourceCollection Class

DataSourceCollection Members

Item Overload

Microsoft.Office.InfoPath Namespace