What I need to do is this:
1. On tab 5 on a Windows form I want a selection of 15 or so Radio Buttons.
2. On tab 6 on the same windows form, I want a full screen Microsoft Report Viewer.
3. I want to have the 15 or so Local Reports individually defined and saved in the project. (Each one would be linked to a table or tables in a typed data set which is also a part of the project.)
4. When the user clicks on of the radio buttons, I want to have that report show up in the Report Viewer.
5. So far, I have had no problems creating Test Reports using the Report Wizard.
6. I can have the first report show up on the Report Viewer by using the smart tag on the top right hand side of the Report Viewer. The Report Viewer Smart Tag allows you to select one of the reports in a drop down box and this all works fine when you run the project.
7. However the process of programmatically changing the report over to another report seems to be very complicated and I need some help please. The best I can come up with so far seems to change the Report Headings OK, but then the report shows with no data!
8. What I have tried to do is to make up a button click procedure for each button change event, and get this to pass three variables down to a JPChangeReport sub procedure
9. My code follows. I have copied most of it from the code which was automatically generated from the smart tag, and some from code suggestions on the web or in Experts Exchange, but I still can’t seem to get it to work!
10. I am also a little puzzled why the Report definition data source shows a table in the data set, but the auto code generated by the smart tag calls up a related Binding Source?
11. Any help would be greatly appreciated.
Private Sub tab5OptTest_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles tab5OptTest.Click
JPChangeReport("ExamPlannerDataSet1_Prices", "Me.PricesBindingSource", "ExamPlannerV2.Test for Prices.rdlc")
Sub JPChangeReport(ByVal DataSourceName As String, ByVal DataSourceValue As String, ByVal ReportName As String)
Dim ReportDataSource As Microsoft.Reporting.WinForms.ReportDataSource = New Microsoft.Reporting.WinForms.ReportDataSource
Me.ReportViewer1.Reset() 'Clears previous report information
Me.ReportViewer1.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.ReportViewer1.Dock = System.Windows.Forms.DockStyle.Fill
ReportDataSource.Name = DataSourceName
ReportDataSource.Value = DataSourceValue
Me.ReportViewer1.LocalReport.ReportEmbeddedResource = ReportName
Me.ReportViewer1.LocalReport.ReportPath = ""
Me.ReportViewer1.Location = New System.Drawing.Point(3, 3)
Me.ReportViewer1.Name = "ReportViewer1"
Me.ReportViewer1.Size = New System.Drawing.Size(987, 513)
Me.ReportViewer1.TabIndex = 1