Local Reports - Strategy?

Xoqon

New member
Joined
Jan 8, 2008
Messages
2
Programming Experience
5-10
Hi

I'm currently writing my first .NET app.

I've created a form, put a Report Viewer control on it, created my table adapter etc and can load an rdlc into it just fine. My report works as it should. However, I've discovered (I think) that I can only bind the Report Viewer control to the rdlc at design time. This means that for each local report I have to create, I have to create a new rdlc file (obviously!) AND a new form with its own Report Viewer control on it. This doesn't strike me as being the most efficient of methods, as the app will eventually have a few dozen reports. Ideally I'd like to load and bind the rdlc, table adapter etc into a single Report Viewer on a single form, at runtime, but fear I cannot do this.

Can anyone either resolve my dilemma or suggest an alternative reporting strategy?

Thanks for your help.

Xoqon
 
On my Form load event I tried this:


VB.NET:
        Select Case sReportName

            Case "report1"
                Me.Report1TableAdapter.Fill(Me.MyDataSet.Report1, gReport1ID)

                Me.ReportViewer1.LocalReport.ReportEmbeddedResource = "MyApp.report1.rdlc"

            Case "report2"

                Me.Report2TableAdapter.Fill(Me.MyDataSet.Rerport2, gReport2ID)

                Me.ReportViewer1.LocalReport.ReportEmbeddedResource  = "MyApp.report2.rdlc"

                Me.ReportViewer1.LocalReport.ReportEmbeddedResource  = "MyApp.report2.rdlc"


        End Select

        Me.ReportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout)
        Me.ReportViewer1.RefreshReport()

Either case will work PROVIDED I bind the ReportViewer control to either .rdlc. I can only do this at design time. See http://msdn2.microsoft.com/en-us/library/ms252085(VS.80).aspx

Any ideas?
 
Last edited by a moderator:
how come you don't have access to a property specifying the rdlc file? If this is read only though, maybe you could try creating the ReportViewer control dynamically.
 
Back
Top