How to close crystal reports viewer when is discontinued/abandoned.

RayBakker
RayBakker used Ask the Experts™
on
Greetings

I have the following code:

CRReports.crRpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, True, "Title of the Report")
CloseCrystalReports()

.
.
.
.
Private Sub CloseCrystalReports()
        If CRReports.crRpt IsNot Nothing Then
            CloseReports(CRReports.crRpt)
            CRReports.crRpt.Close()
            CRReports.crRpt.Dispose()
            CRReports.crRpt = Nothing
        End If
        GC.Collect()
        GC.WaitForPendingFinalizers()
        GC.Collect()
    End Sub

Now since the the CR is opened in a New window, the  CloseCrystalReports() never gets called. I thought I could add the close and dispose to the CRReport.vb but I don't know what I would be closing or if it is even possible.

Please advice.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Application Developer Analyst
Commented:
I have added page_unload sub the at calls the CR close sub. Works like a charm.

all good now.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial