Print RDLC Report Directly to Printer with SubReports! RRS feed

  • Question

  • I am currently printing a report directly to the default printer using the code from this link.

    However I have now changed the report to use three subreports and I am wondering if anyone knows how to do that.  When I use the reportviewer I had to add the code

    AddHandler ReportViewer1.LocalReport.SubreportProcessing, AddressOf SubreportProcessingEventHandler

    and the this code:

    Public Sub SubreportProcessingEventHandler(ByVal sender As Object, ByVal e As SubreportProcessingEventArgs)
            Dim zrpt = e.ReportPath
            Select Case zrpt
                Case "WOPartsSubReport"
                    Dim ds1 As New WOPartsSubReportDataSet
                    Dim da1 As New WOPartsSubReportDataSetTableAdapters.wopartsTableAdapter
                    e.DataSources.Add(New ReportDataSource("DataSet1", ds1.Tables("woparts")))
                Case "WOLaborSubReport"
                    Dim ds2 As New WOLaborSubReportDataSet
                    Dim da2 As New WOLaborSubReportDataSetTableAdapters.wolaborTableAdapter
                    e.DataSources.Add(New ReportDataSource("DataSet1", ds2.Tables("wolabor")))
                Case "WOLockoutSubReport"
                    Dim ds As New WOLockOutSubReportDataSet
                    Dim da As New WOLockOutSubReportDataSetTableAdapters.wolockTableAdapter
                    e.DataSources.Add(New ReportDataSource("DataSet1", ds.Tables("wolock")))
            End Select
        End Sub

    But now that I am NOT using a reportviewer how can I still get the subreports to work and still print directly to the printer?  Where would I put the code to do that?



    Monday, July 1, 2013 12:16 PM

All replies

  • Hi Stacy,

    Thank you for your question. 

    I am trying to involve someone more familiar with this topic for a further look at this issue. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated. 

    Thank you for your understanding and support.

    Charlie Liao

    If you have any feedback on our support, please click here.

    Charlie Liao
    TechNet Community Support

    Tuesday, July 2, 2013 6:39 AM
  • Hello Stacy,

    I am not sure what you mean with "not using a reportviewer"
    Microsoft.Reporting.WinForms is the ReportViewer Windows forms control.

    Do you get a specific error or see some issue when trying to print the report with the subreports?

    Microsoft Online Community Support
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Tuesday, August 6, 2013 10:35 AM