Skip to Content
author's profile photo Former Member
Former Member

Temp folder filling up with report copies?

<p>I&#39;ve noticed that my temp directory has tons of .rpt files in it -- and it looks like they are the same reports that I&#39;m opening up in the CrystalReportViewer control in my app. Is there any way to stop this or get the viewer to clean them up? I&#39;ve got CRXI R2 Developer.</p><p><br />TIA,<br />Matt</p>

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2007 at 04:14 AM

    Which version of Visual Studio are you using? Is your app in ASP.NET or is it a Windows app? Are your app explicitly close the report?

    We use the following code in the PageUnload event handler from our ASP.NET app to make sure that the report is closed (C#):

    Â Â private void Page_Unload(object sender, EventArgs e)
    Â {
    Â Â Â CloseReports(crReport);
    Â Â Â crystalReportViewer.Dispose();
    Â Â Â crystalReportViewer = null;
    Â }

    The CloseReports method looks like this:

    Â private void CloseReports(ReportDocument reportDocument)
    Â {
    Â Â Â Sections sections = reportDocument.ReportDefinition.Sections;
    Â Â Â foreach (Section section in sections)
    Â Â Â {
    Â Â Â Â Â ReportObjects reportObjects = section.ReportObjects;
    Â Â Â Â Â foreach (ReportObject reportObject in reportObjects)
    Â Â Â Â Â {
    Â Â Â Â Â Â Â if (reportObject.Kind == ReportObjectKind.SubreportObject)
    Â Â Â Â Â Â Â {
    Â Â Â Â Â Â Â Â Â SubreportObject subreportObject = (SubreportObject)reportObject;
    Â Â Â Â Â Â Â Â Â ReportDocument subReportDocument = subreportObject.OpenSubreport(subreportObject.SubreportName);
    Â Â Â Â Â Â Â Â Â subReportDocument.Close();Â Â Â Â Â Â Â Â Â Â
    Â Â Â Â Â Â Â }
    Â Â Â Â Â }
    Â Â Â }
    Â Â Â reportDocument.Close();
    Â }

    Â

    -Dell

    - A computer only does what you told it to, not what you thought you told it to!</p>

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.