TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Tall Boy
NA
7
1k
Writing a multi report reportviewer in win forms
Apr 16 2017 6:38 AM
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
;
//Portrait
setup.Margins =
new
System.Drawing.Printing.Margins(1, 1, 1, 1);
this
.reportViewer1.SetPageSettings(setup);
//Me.ReportViewer1.Reset()
//ReportViewer1.LocalReport.DataSources.Clear()
ReportDataSource CurrentReportDataSource =
new
ReportDataSource();
switch
(ReportNo) {
case
1: {
// 'TODO: This line of code loads data into the 'CAMHSDataSet.ShowAllWaitingAtEndOfMonth' table. You can move, or remove it, as needed.
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);
// Pass in 1 report parameters
ReportParameter[] parameters =
new
ReportParameter[1];
parameters[0] =
new
ReportParameter(
"PatientID"
,
this
.PatientID.ToString());
this
.reportViewer1.LocalReport.SetParameters(parameters);
// setup.Landscape = true;
break
;
}
// Case 2
// '' Show All Patients at Month End
// this.ShowCurrentPatientsAtEndOfMonthTableAdapter.Fill(Me.CAMHSDataSet1.ShowCurrentPatientsAtEndOfMonth, EndDate)
// reportViewer1.LocalReport.ReportEmbeddedResource = "BusinessReports.RptAllPatientsMonthEnd.rdlc"
//
default
: {
MessageBox.Show(
"No Report found"
);
break
;
}
}
this
.reportViewer1.RefreshReport();
any suggesstions appreicated!
Reply
Answers (
2
)
Multi Columns filtered gridview
how to add 0 row in database Windows Application #