views:

1251

answers:

2

I'm trying to get ReportViewer to display data from a BindingSource (VB.Net Winforms).

I built the report on the underlying dataset. Then I configured the Data Source Instance to the BindingSource. I thought that would apply the sorting, filtering, etc. But it just looks like the data is coming from the dataset instead of the BindingSource.

I suspect I'm missing something simple.

Update: Or maybe it isn't so simple - I posted this a few days ago and still nobody knows the answer! Maybe I'm trying to do something that can't be done?

A: 

You'll need to specify the sorting in the report (in the RDL), since it applies its own sorting logic.

Anthony
A: 

Here's a solution I used. You put the data from the BindingSource into a DataTable and then have the Report use the DataTable.

    ReportViewer1.Reset()
    Dim dt As DataTable
    dt = DirectCast(Form1.ProgActnBindingSource.Current, DataRowView).DataView.ToTable

    Dim rs = New ReportDataSource
    rs.Name = "name"
    rs.Value = dt

    ReportViewer1.ProcessingMode = ProcessingMode.Local
    ReportViewer1.LocalReport.DataSources.Clear()
    ReportViewer1.LocalReport.DataSources.Add(rs)
    ReportViewer1.LocalReport.ReportEmbeddedResource = "projectname.Report1.rdlc"

    Me.ReportViewer1.RefreshReport()
ScottStonehouse