Hi,
I am trying to write a win forms app in c# using a reportviewer such that the users chooses a report from a list of reports and depending on the report the reportviewer shows the chosen report at run time. I was able to do it using vb.net previously but finding followinfgthe same pattern in c# is not working. I've searched the web but nof found anything similar..
Here is my code any ideas?
Here the load event code...
- var setup = this.reportViewer1.GetPageSettings();
- setup.Landscape = false;
- setup.Margins = new System.Drawing.Printing.Margins(1, 1, 1, 1);
- this.reportViewer1.SetPageSettings(setup);
-
-
- ReportDataSource CurrentReportDataSource = new ReportDataSource();
- switch (ReportNo) {
- case 1: {
-
- this.GetPatientDetailsTableAdapter.Fill(this.MediClinicDB1DataSet.GetPatientDetails, PatientID);
- this.reportViewer1.LocalReport.ReportEmbeddedResource = "MediPraticeOne.RptPatientReferral.rdlc";
-
- CurrentReportDataSource.Name = "GetPatientDetails";
- CurrentReportDataSource.Value = GetPatientDetailsBindingSource;
- reportViewer1.LocalReport.DataSources.Add(CurrentReportDataSource);
-
- ReportParameter[] parameters = new ReportParameter[1];
- parameters[0] = new ReportParameter("PatientID", this.PatientID.ToString());
- this.reportViewer1.LocalReport.SetParameters(parameters);
-
- break;
- }
-
-
-
-
-
-
- default: {
- MessageBox.Show("No Report found");
- break;
- }
- }
-
- this.reportViewer1.RefreshReport();
any suggesstions appreicated!