load multiple .rpt pages?

bob.walker

Member
Joined
May 17, 2005
Messages
18
Programming Experience
3-5
I have several pages that can be printed out. I want to be able to "Print ALL" as well.

Private Sub bPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bPrint.Click

Dim oCRV as New ReportDocument

if me.cbPage1.checked then
loadPage1(oCRV)
elseif me.cbPage2.checked then
loadPage2(oCRV)
else
loadPage3(oCRV)
endif

End Sub

private sub loadPage1(oCRV As ReportDocument)

oCRV.Load(Server.MapPath("Page1.rpt"))
Me.CRView.ReportSource = oCRV

End Sub

private sub loadPage2(oCRV As ReportDocument)

oCRV.Load(Server.MapPath("Page2.rpt"))
Me.CRView.ReportSource = oCRV

End Sub

private sub loadPage3(oCRV As ReportDocument)

oCRV.Load(Server.MapPath("Page1.rpt"))
'How do I select next page??
oCRV.Load(Server.MapPath("Page2.rpt"))
Me.CRView.ReportSource = oCRV

End Sub


Thanks for any help.

 
I'll give you several different options:

Set up the report viewer on its own form. Call the form with ShowDialog passing it the first report. Next call the form again with the second report right after it. The Second report will show when the first report has been closed by (ShowDialog).

Set up a combobox with the selected report names in it on the report viewer form. Use the SelectedIndexChanged method of the combobox to switch the ReportSource of the viewer. If the user selects the first combobox entry clear the report. In your case it still might be wise to have the report viewer on a seperate form from the report selection form.

When I have a series of reports to print I use a Print/Preview/Cancel form to allow the user the option to send the reports directly to the printer without viewing "the print option". The preview option uses the first example to display the reports in order. The cancel option does nothing.

Hope that helps...
 
Back
Top