Edit

Share via


DataSourceCollection.Item[] Property

Definition

Overloads

Item[Int32]

Gets a reference to the specified DataSource object from the DataSourceCollection by index value.

Item[String]

Gets a reference to the specified DataSource object from the DataSourceCollection by name.

Item[Int32]

Gets a reference to the specified DataSource object from the DataSourceCollection by index value.

public:
 abstract property Microsoft::Office::InfoPath::DataSource ^ default[int] { Microsoft::Office::InfoPath::DataSource ^ get(int index); };
public abstract Microsoft.Office.InfoPath.DataSource this[int index] { get; }
member this.Item(int) : Microsoft.Office.InfoPath.DataSource
Default Public MustOverride ReadOnly Property Item(index As Integer) As DataSource

Parameters

index
Int32

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

Property Value

The DataSource object for the specified index value.

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)

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.

Applies to

Item[String]

Gets a reference to the specified DataSource object from the DataSourceCollection by name.

public:
 abstract property Microsoft::Office::InfoPath::DataSource ^ default[System::String ^] { Microsoft::Office::InfoPath::DataSource ^ get(System::String ^ name); };
public abstract Microsoft.Office.InfoPath.DataSource this[string name] { get; }
member this.Item(string) : Microsoft.Office.InfoPath.DataSource
Default Public MustOverride ReadOnly Property Item(name As String) As DataSource

Parameters

name
String

The name of the DataSource object to get.

Property Value

The DataSource object for the specified name.

Examples

In the following example, the DataSource object named "File1" in the DataSourceCollection of the form template is retrieved and assigned to a variable.

DataSource myDataSource = this.DataSources["File1"]; Dim myDataSource As DataSource = Me.DataSources("File1")

Remarks

The string or string expression passed as the argument for name must be the name of a member of the collection.

After you have set a reference to the DataSource object that 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.

Applies to