Click here to Skip to main content
15,944,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

I use Visual Studio 2008 and I want to print a report in a reportviewer automatically. The following code I have to open the report:

Dim rptDataSource As New Microsoft.Reporting.WebForms.ReportDataSource
rptDataSource.Name = "dsInvoice_Invoice"
rptDataSource.Value = Me.ObjectDataSource5


    With Me.ReportViewer.LocalReport
        .ReportPath = "Secure/Reports/" & Request.QueryString("Report") & ".rdlc"
        Dim Parameters(0) As ReportParameter
        Parameters(0) = New ReportParameter("Factuurnummer", Request.QueryString("Factuurnummer"))
    End With
Catch ex As Exception
    ErrorHandling("Invoice Load Details -- " & ex.Message.ToString)
End Try

I want to print the report automatically when the page is opened.

Can you please help me?

With kind regards,

Dennis Huisman
Slacker007 10-Dec-10 11:40am    
go to your account settings and change your screen name to something other than you e-mail address.

1 solution

You probably need to render the report and then send it to a PrintDocument object.

Is this WinForms or Web-based?
Share this answer
thatraja 11-Dec-10 2:04am    
[Comment from OP[Dennis Huisman](Moved from Answer)]
Thank you for answering my question!
It is webbased.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900