CompiledReport.Printed event doesn't work on assembly report

Stimulsoft Reports.NET discussion
Post Reply
TGoertler
Posts: 24
Joined: Wed Aug 25, 2010 9:16 am
Location: Gundelsheim/Germany

CompiledReport.Printed event doesn't work on assembly report

Post by TGoertler »

Hello,

I use something like the following code to close a StiViewerForm automatically after printing (VB.NET):

Code: Select all

Private stiVewForm As New Stimulsoft.Report.Viewer.StiViewerForm

Private Sub ButtonShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonShow.Click
    Dim report As StiReport
    report = StiReport.GetReportFromAssembly("myreport.dll", True)
    AddHandler report.CompiledReport.Printed, AddressOf report_Printing  ' !! <- This doesn't work as report.CompiledReport is Nothing
    report.Render()
    stiVewForm.Report = report
    stiVewForm.Show()
End Sub

Private Sub report_Printing(ByVal sender As Object, ByVal e As EventArgs)
    Dim report As StiReport = TryCast(sender, StiReport)
    If (report.PrinterSettings.PrintDialogResult = DialogResult.OK) Then
        MessageBox.Show("Printing")
    End If
    stiVewForm.Close()
End Sub
The problem is, that the AddHandler doesn't work as report.CompiledReport is Nothing. I also tested report.Printed instead but this event does'n get fired when printing finishes.

Is there any other way to use the printed event of a report loaded from an assembly to automatically close the viewer form?

Thank you in advance.
Best Regards,
Thomas
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: CompiledReport.Printed event doesn't work on assembly re

Post by Alex K. »

Hello,

Your report is already compiled. You need subscribe on report.Printed event. We check it and all works correctly, please try to check the last prerelease build.
Also you can subscribe on the following event:

Code: Select all

StiOptions.Engine.GlobalEvents.ReportPrinted
Thank you.
TGoertler
Posts: 24
Joined: Wed Aug 25, 2010 9:16 am
Location: Gundelsheim/Germany

Re: CompiledReport.Printed event doesn't work on assembly re

Post by TGoertler »

Hello Aleksey,

I got it working now, thank you very much!!

Thomas
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Re: CompiledReport.Printed event doesn't work on assembly re

Post by Andrew »

Hello,

Perfect!
Post Reply