hi guys am trying create a multiple reports using a single report viewer.
can this be done, if yes can u give me a clue on hw to go on about it. i have done everything its just the part of having multiple reports

Recommended Answers

All 11 Replies

hello !
can you please tell me , which reporting tool you are using ?

hello !

can you please tell me , which reporting tool you are using ?

am using the report viewer that comes in V.S 2010

i mean , are you using crystal reports , telerik reports , active x reports , etc ?

if you are using telerik reports then
use

rptViewer.Report = new yourReportName();

if you are using crystal reports then

crViewer.ReportSource = yourReportName 
CrystalReportSource1.Report = yourReportName

hope this will helps you ,
Regards

and if you want to open multiple reports in single report viewer then you have to use same code on differnt buttons , for example , buttonA,buttonB , use this code

crViewer.ReportSource = ReportA 'this is for buttonA
crViewer.ReportSource = ReportB 'This is for buttonB

or if you are using some golbal variable then just use select case statement on the report viewer load event

Hope This will helps You

i mean , are you using crystal reports , telerik reports , active x reports , etc ?

if you are using telerik reports then
use

rptViewer.Report = new yourReportName();

if you are using crystal reports then

crViewer.ReportSource = yourReportName 
CrystalReportSource1.Report = yourReportName

hope this will helps you ,
Regards

here is a sample of my code hope it can help.
the report am using is the RDLC report that is created by report viewer.
' Try
' Me.Login_AttpsTableAdapter.Fill(Me.School_management_DBDataSet.Login_Attps)
' rpvReport_Viewer.RefreshReport()
'Catch ex As Exception
' MessageBox.Show("Error")
'End Try

in this code you are not assigning any report to report viewer , use this

rpvreport_viewer.report=yourreportname
rpvreport_viewer.show()

Hope this will helps you

in this code you are not assigning any report to report viewer , use this

rpvreport_viewer.report=yourreportname
rpvreport_viewer.show()

Hope this will helps you

when i type "rpvreport_viewer.report=yourreportname" the report part is not showing
is there a way you can show me......i cant start from zero and work my way up

hello !
i try same thing at my end , and i works , i use this code

'first make a madule to store global vaiable name ReportName as string 
now place two or more buttons on the form , and place this code on the click event of the button 

ReportName = ""
ReportName = "ReportA" ' this code is on ButtonA click Event
ReportName = "ReportB" 'This code is on buttonB click Event
'now use this code on the load event of the form having report viewer
select case ReportName
 case "ReportA"
           ReportViewer1.ReportSource = New ReportA
        ReportViewer1.Show()
 Case "ReportB"
        ReportViewer1.ReportSource = New ReportB
        ReportViewer1.Show()
EndSelect

Hope this time this will works for you
if Your prob is solved mark this thread solved :)


Regards

M.Waqas Aslam

is still not working when i click the smart tag and pick the report that is the only report showing. i want when i click report A the Report A shows

but in mine when i click report B , report A is show not Report B that i want

you have to close the reportviewer form , in order to show reportB , because we are assigning the report to report viewer on the load event .

Regards

Here's a solution that could help you. It will be efficient but quite not perfect.
If you are using crystal reports with Visual studio 2010. You could try creating multiple report headers. But you should adjust your headers size so that they fit in one page.
There's another solution I found here. I hope it helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.