REPORTVIEW

Mar 31 2010 5:45 AM
Hello...

I am trying to switch between to reports(rdlc), in one reportviewer( not Crystal report but MS). I want to use a timer...

I get an error saying, that there is no datasource set for the report..


this is my code :

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

        Dim ReportDataSource1 = New Microsoft.Reporting.WinForms.ReportDataSource()

        Select Case Me.ReportViewer_main.LocalReport.ReportEmbeddedResource

            Case "DeskTopKalk.Report_Hour_Md3.rdlc"

                ReportDataSource1.Name = "Mamconnection_Report_Hour_Sum"

                ReportDataSource1.Value = Me.Report_Hour_SumBindingSource

                Me.ReportViewer_main.Reset()

                Me.ReportViewer_main.LocalReport.DataSources.Clear()

                Me.ReportViewer_main.ProcessingMode = ProcessingMode.Local

                Me.ReportViewer_main.LocalReport.DataSources.Add(ReportDataSource1)

                Me.ReportViewer_main.LocalReport.ReportEmbeddedResource = "DeskTopKalk.Report_Hour_Sum.rdlc"

                Me.ReportViewer_main.RefreshReport()


            Case "DeskTopKalk.Report_Hour_Sum.rdlc"

                ReportDataSource1.Name = "Mamconnection_Report_Hour_Md3"

                ReportDataSource1.Value = Me.Report_Hour_Md3BindingSource

                Me.ReportViewer_main.Reset()

                Me.ReportViewer_main.LocalReport.DataSources.Clear()

                Me.ReportViewer_main.ProcessingMode = ProcessingMode.Local

                Me.ReportViewer_main.LocalReport.DataSources.Add(ReportDataSource1)

                Me.ReportViewer_main.LocalReport.ReportEmbeddedResource = "DeskTopKalk.Report_Hour_Md3.rdlc"

                Me.ReportViewer_main.RefreshReport()


        End Select


    End Sub