none
"Report processing was cancelled" message during report load when run outside Visual Studio RRS feed

  • Question

  •  

    I'm using the Windows Forms Local ReportViewer (C#, Visual Studio 2008) to display a report of some local data (enough that the report takes a few seconds to load).  If I run the report through Visual Studio, everything works as expected, and I get a "Report is being generated" message and a green circle progress image while the report is loading.  If I run outside Visual Studio, the report displays "Report processing was cancelled" in grey while the report loads, then when the report completes, the message goes away and the report loads correctly, just as it did through Visual Studio.

     

    What I've read so far tells me that this happens if you try to render a report twice, by calling RefreshReport more than once, or by calling both RefreshReport and SetDisplayMode.  Here's an excerpt of what I'm doing in my formLoad:

     

    // (Left out code where I got the data for the report parameters,

    // filled the TableAdapter, and hid/unhid some buttons)
    reportViewer.Clear();
    reportViewer.LocalReport.SetParameters(...)
    reportViewer.SetDisplayMode(DisplayMode.PrintLayout);
    reportViewer.ZoomMode = ZoomMode.PageWidth;

     

    I've seen this thread, which says to move the SetDisplayMode and ZoomMode to RenderingComplete, but if I do that the report hangs:

     

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1170192&SiteID=1

     

    I tried setting a flag to ensure that the SetDisplayMode/ZoomMode only happen once, and putting the code in an "if (ZoomMode == PageWidth)" statement, but neither works.  I'm pretty sure this happened in the previous version of Visual Studio also, if that's important.

     

    I'd really like for the customer to be able to see the "Report is being generated" message as well.  Any suggestions?

     

    Thanks in advance,
    Leanne

    Wednesday, February 27, 2008 8:34 PM

Answers

  • Are you saying that with the message box in the code, you click three times on a single message box or that you get three separate message boxes.  Three separate message boxes would indicate that your code is executing three times and would explain the cancelled rendering since each SetDisplayMode call would cancel the previous one.

    Thursday, February 28, 2008 2:11 AM
    Moderator

All replies

  • Some more information:

     

    Setting reportViewer.ShowProgress = true doesn't help.

     

    If I pop up a message box before my SetDisplayMode call, like this:

     

    reportViewer.LocalReport.SetParameters(...)

    MessageBox.Show("message");
    reportViewer.SetDisplayMode(DisplayMode.PrintLayout);
    reportViewer.ZoomMode = ZoomMode.PageWidth;

     

    then when I run the report, I have to click "ok" three times to get to the report, but I *do* get the "Report is being generated" message and progress image while the report loads.  That's not really an ideal solution, though. Smile

     

    Ideas?

    Wednesday, February 27, 2008 10:50 PM
  • Are you saying that with the message box in the code, you click three times on a single message box or that you get three separate message boxes.  Three separate message boxes would indicate that your code is executing three times and would explain the cancelled rendering since each SetDisplayMode call would cancel the previous one.

    Thursday, February 28, 2008 2:11 AM
    Moderator
  •  

    Thanks for the response.

     

    Yes, it appears that the code is being called two extra times from an OnValueChanged event on the form that I didn't realize was being triggered when the report loaded.  Now that I see where that's coming from, I should be able to fix it.

     

    Thanks again,

    Leanne

    Thursday, February 28, 2008 6:05 AM