Hi,
I having been using VS 2013 for a few months now and decided I would try and get a Report Viewer on a Form to show different reports.
I use a Form for the user to choose the report and then on launching the Report Viewer I change the details to show that specific report.
There's a few examples on the internet which I have followed very closely but its very tricky. Maybe somebody done something similar.
See How to Switch Reports in a ReportViewer - Ged Mead's Blog - vbCity - The .NET Developer Community
Here my code the FrmReportViewer load. All my dataset test out OK as does the DB connections and rdlc.
Again all help appreciated.
I having been using VS 2013 for a few months now and decided I would try and get a Report Viewer on a Form to show different reports.
I use a Form for the user to choose the report and then on launching the Report Viewer I change the details to show that specific report.
There's a few examples on the internet which I have followed very closely but its very tricky. Maybe somebody done something similar.
See How to Switch Reports in a ReportViewer - Ged Mead's Blog - vbCity - The .NET Developer Community
Here my code the FrmReportViewer load. All my dataset test out OK as does the DB connections and rdlc.
VB.NET:
Private Sub FrmReportViewer_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim ReportNo As Integer = FrmMainMenu.ReportNo
ReportViewer1.LocalReport.DataSources.Clear()
Dim CurrentReportDataSource = New ReportDataSource()
Select Case reportNo
Case 1
ReportViewer1.LocalReport.ReportEmbeddedResource = "BusinessReports.RptAllPatients.rdlc"
CurrentReportDataSource.Name = "CASDataSet"
CurrentReportDataSource.Value = GetAllPatientsBindingSource
ReportViewer1.LocalReport.DataSources.Add(CurrentReportDataSource)
Me.GetAllPatientsTableAdapter.Fill(Me.CASDataSet.GetAllPatients)
Case 2
Dim MEDate As Date = FrmMainMenu.cbEndDate.Value
ReportViewer1.LocalReport.ReportEmbeddedResource = "BusinessReports.RptGetAllStaff.rdlc"
' ReportViewer1.LocalReport.ReportPath = "RptGetAllStaff.rdlc"
CurrentReportDataSource.Name = "CASDataSet2"
CurrentReportDataSource.Value = GetAllStaffBindingSource
ReportViewer1.LocalReport.DataSources.Add(CurrentReportDataSource)
Me.GetAllStaffTableAdapter.Fill(Me.CASDataSet2.GetAllStaff, MEDate)
Case Else
MessageBox.Show("Report not Found", "CAS Alert !")
End Select
Me.ReportViewer1.RefreshReport()
End Sub
Again all help appreciated.