Page 1 of 1

CompiledReport.Printed event doesn't work on assembly report

Posted: Fri Aug 02, 2013 11:55 am
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

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

Posted: Mon Aug 05, 2013 7:33 am
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.

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

Posted: Mon Aug 05, 2013 3:08 pm
by TGoertler
Hello Aleksey,

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

Thomas

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

Posted: Tue Aug 06, 2013 8:19 am
by Andrew
Hello,

Perfect!