次の方法で共有


DataSourceCollection.Item Property (String)

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

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

Syntax

'Declaration
Public MustOverride ReadOnly Default Property Item ( _
    name As String _
) As DataSource
    Get
'Usage
Dim instance As DataSourceCollection
Dim name As String
Dim value As DataSource

value = instance(name)
public abstract DataSource this[
    string name
] { get; }

Parameters

  • name
    Type: System.String

    The name of the DataSource object to get.

Property Value

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

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.

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")

See Also

Reference

DataSourceCollection Class

DataSourceCollection Members

Item Overload

Microsoft.Office.InfoPath Namespace