Share via


DataSource.Name Property (Microsoft.Office.InfoPath)

Gets the name of the associated DataSource object.

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

Syntax

'Declaration
Public MustOverride ReadOnly Property Name As String
'Usage
Dim instance As DataSource
Dim value As String

value = instance.Name
public abstract string Name { get; }

Property Value

The name of the data source.

Remarks

The name of the DataSource object is the same as the name of the data source that it represents. The name of the DataSource object can also be used as the argument to the Item property of the DataConnectionCollection type.

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 Office InfoPath 2007 or in a Web browser.

Example

In the following example, the name of each DataSource object in the DataSourceCollection is displayed in a message box.

foreach (DataSource source in this.DataSources)
{
   MessageBox.Show("Source name: " + source.Name);
}
For Each source As DataSource In Me.DataSources
{
   MessageBox.Show("Source name: " & source.Name)
}

See Also

Reference

DataSource Class
DataSource Members
Microsoft.Office.InfoPath Namespace