Share via


ReportDataSource Constructor (String, Object)

 

Constructs a named data source with a value.

Namespace:   Microsoft.Reporting.WinForms
Assembly:  Microsoft.ReportViewer.WinForms (in Microsoft.ReportViewer.WinForms.dll)

Syntax

public ReportDataSource(
    string name,
    object dataSourceValue
)
public:
ReportDataSource(
    String^ name,
    Object^ dataSourceValue
)
new : 
        name:string *
        dataSourceValue:Object -> ReportDataSource
Public Sub New (
    name As String,
    dataSourceValue As Object
)

Parameters

  • dataSourceValue
    Type: System.Object

    A value for the data source.

Remarks

Value may be an instance of DataTable, a IEnumerable value (for example, DataView or Array), or a BindingSource.

If this value is an instance of IEnumerable, all elements in the collection must be of the same type, and names of the public properties of the element (as retrieved by the M:System.ComponentModel.TypeDescriptor.GetProperties method) must match the field names of the corresponding report data source.

Value may also be an instance of Type. In this case, an instance of the supplied type is automatically created and added to an automatically created collection.

If the type of Value is not any of the aforementioned types, it is added to an automatically created collection.

Examples

Legacy Code Example

For code examples, see LocalReport.

See Also

ReportDataSource Overload
ReportDataSource Class
Microsoft.Reporting.WinForms Namespace

Return to top