This is a migrated thread and some comments may be shown as answers.

Selecting reports dynamically

2 Answers 132 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Matthew Hile
Top achievements
Rank 1
Matthew Hile asked on 05 Dec 2008, 12:38 PM
In win forms I have a report selector form and a report viewer form. I populate the report selector list from a database. This lets me add new reports without changing the code in either form. However, I cannot figure out how to call the user selected report generically. What I can do is to hard code the selection options in the viewer using a case statement:

        Select Case param 'param is a String of the user's selection passed from the calling form
            Case "Report1"
                Me.ReportViewer1.Report = New MyClassLib.Report1
            Case "Report2"
                Me.ReportViewer1.Report = New MyClassLib.Report2
        End Select

To make it more generic I want to use the passed parameter to specify the report. Something like this:

    Me.ReportViewer1.Report = New MyClassLib.param

Any suggestions as to how to accomplish this?

Thanks, Matthew

2 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 05 Dec 2008, 01:11 PM
Hello Matthew,

I've attached a sample application that shows you the approach we have used for the included Telerik Reports examples we ship with the installation. Note that after adding a new report item to the class library and rebuilding, the new report is automatically found and listed.

Regards,
Steve
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Matthew Hile
Top achievements
Rank 1
answered on 05 Dec 2008, 01:21 PM
Thanks! I will this a look and a try.
Tags
General Discussions
Asked by
Matthew Hile
Top achievements
Rank 1
Answers by
Steve
Telerik team
Matthew Hile
Top achievements
Rank 1
Share this question
or