Skip to Content

"system cannot find the path specified" way to know the actual error?

Hi,

I have time using CR, but im always bothered about the error "system cannot find the path specified", because it could be anything, im wondering if there is a way to know exactly what is the error.

I have the following testing scenario:

-Report has the header page size larger than the actual page size (this is the error i want to catch).

-here is the code:

try

Dim ReportStream as System.IO.Stream = OutputReport.ExportToStream(OutputReport.ExportOptions.ExportFormatType)

catch ex as exception

dim s as string = ex.message

end try

when i try to generate the document the error message im getting is "system cannot find the path specified", even though i know the actual error is from header size large than page size, is there a way to catch the specific errors?



Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Oct 22, 2018 at 08:46 PM

    Hi Antonio,

    Unfortunately we don't have Events when exporting, only when viewing.

    Because the report engine does not render and format the page until it is either Viewed, Printed or Exported there is no way to generate the actual error. but I see your point, the error is misleading... I'll ask R&D about this...

    If you add a Viewer Error Event:

    private void crystalReportViewer1_Error(object source, ExceptionEventArgs e)
    {
        string eError = "";
        int StringLen = 0;
        eError = e.Exception.Message.ToString();
        StringLen = eError.Length;
        if (StringLen >= 61)
        {
            if (eError.Substring(0, 61) == @"The remaining text does not appear to be part of the formula.")
            {
                MessageBox.Show("Possible missing UFL or actual error in formula");
                eError = eError.Substring(0, StringLen - 2);
                ////cool but of no use to release mode unless you have your own help file
                string myURL = @"http://search.sap.com/ui/scn#query=" + eError + "☆tindex=1&filter=scm_a_resourceType(scm_v_resType252)";
                string fixedString = myURL.Replace(" ", "%20");
    
                //System.Diagnostics.Process.Start(@"C:\Program Files (x86)\Internet Explorer\iexplore.exe", myURL);
                System.Diagnostics.Process.Start(@"C:\Program Files (x86)\Mozilla Firefox\firefox.exe", fixedString);
                e.Handled = true;
            }
            else
            {
                MessageBox.Show("Trigger Event - Error in Viewer: " + e.ToString());
            }
        }
        else
        {
            if (eError.ToString() == "The system cannot find the path specified.\r")
            {
                MessageBox.Show(eError);
                eError = eError.Substring(0, StringLen - 2);
                ////cool but of no use to release mode unless you have your own help file
                string myURL = @"http://search.sap.com/ui/scn#query=" + eError + "☆tindex=1&filter=scm_a_resourceType(scm_v_resType252)";
                string fixedString = myURL.Replace(" ", "%20");
    
                //System.Diagnostics.Process.Start(@"C:\Program Files (x86)\Internet Explorer\iexplore.exe", myURL);
                //System.Diagnostics.Process.Start(@"C:\Program Files (x86)\Mozilla Firefox\firefox.exe", fixedString);
    
                ////string myURL = @"C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports 2011\Help\en\crw.chm";
                ////System.Diagnostics.Process.Start(myURL);
                ////cool but of no use to release mode
            }
            else
                if (eError.ToString() == "Object reference not set to an instance of an object.")
                {
                    MessageBox.Show(eError);
                    eError = eError.Substring(0, StringLen - 2);
                }
    
            //else
            //    MessageBox.Show("Break on this line to get the actual error being trapped");
    
            e.Handled = true;
        }
    }

    You get the actual error:

    You will get the same error in CR Designer.

    Don


    toobig.jpg (22.9 kB)
    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.