locked
VB.Net ReportViewer Local Mode Windows Forms Project RRS feed

  • Question

  • I work in VB.Net and I've got windows forms project that uses the ReportViewer in local mode.  When I run my report using Visual Studio 2005 everything looks fine.  The form pops up, a little green progress image displays, and the report loads just the way I want it to.  However, if I run the .exe outside of Visual Studio this is not the case.  The form pops up, but instead of the green progress image, the report displays the message "Report processing was cancelled." and a few seconds later the report displays just fine. 

    I've downloaded sample projects of a similar nature that were written in C# and I do not get this same problem.  I tried downloading Visual Studio 2005 SP1 and installing but that did not fix the problem.

    I put a counter in my program that counts how many times the RenderingComplete event for my ReportViewer Object fires (Note:I have ONE RefreshReport in my form load event)  When I run the program through Visual Studio (debug or release mode) I get a count of one.  When I run the exe outside of Visual Studio the count is two.

    I've been forced to do a somewhat nasty workaround with a panel in front of my report and a timer object that hides it after a few seconds in order to display my report without showing the error message.  Does anyone know of another solution to this?  I would appreciate any advice.  Thank you.

    Tuesday, January 30, 2007 9:57 PM

Answers

  • I don't know if this will help, but I've found that the following lines will cause the cancel message:

    Me.ReportViewer1.SetDisplayMode(DisplayMode.PrintLayout)
    Me.ReportViewer1.ZoomMode = ZoomMode.PageWidth

    If you put these lines in the Rendering_Complete, no cancel message will appear. But if you put those lines in the load event, you will get the message.

     

    Friday, February 16, 2007 9:34 AM

All replies

  • I'm not sure what is accounting for the difference in the two cases, but calling RefreshReport() or SetDisplayMode() multiple times might be the problem.  Each time you make this call, it will cancel any report processing that is in progress.  As a result, you will see the canceled message you describe until the second processing happens.
    Thursday, February 15, 2007 9:30 PM
  • What you are saying about calling the RefreshReport more than once makes sense.  It seems like that is what is happening.  But I'm NOT calling the RefreshReport more than once.  There is only one instance of RefreshReport in my entire project, and it is in the Load event of the form I'm having problems with.  I'm really starting to think this is a bug, and only occurs when using the report viewer in the VB language.  Please let me know if you have anymore ideas.  I ended up having to create a workaround that hides the report until the Report's RenderComplete event fired twice or a timer reached five seconds...which is not an ideal solution.  And thanks for your input.

    Thursday, February 15, 2007 11:24 PM
  • I don't know if this will help, but I've found that the following lines will cause the cancel message:

    Me.ReportViewer1.SetDisplayMode(DisplayMode.PrintLayout)
    Me.ReportViewer1.ZoomMode = ZoomMode.PageWidth

    If you put these lines in the Rendering_Complete, no cancel message will appear. But if you put those lines in the load event, you will get the message.

     

    Friday, February 16, 2007 9:34 AM
  • Thanks so much for your help!  I did have the SetDisplayMode and ZoomMode properties being set in the Load event, and when I moved them into the Rendering_Complete event the cancel message was gone.  I'm still not sure why the form acts differently when it is run through visual studio compared to just running the exe, but at least my problem is fixed.  Thanks again!
    Monday, February 19, 2007 4:22 PM
  • Glad I could help. I also don't know why it has to be that way!
    Tuesday, February 20, 2007 4:31 PM
  • SetDisplayMode is an implicit rerendering, just like RefreshReport.  So calling it after calling RefreshReport or in RenderingComplete cancels the current rendering and results in the message you are seeing.  You never need to call both RefreshReport and SetDisplayMode.  Calling either one is sufficient.
    Friday, March 2, 2007 11:44 PM
  • You never need to call both RefreshReport and SetDisplayMode.  Calling either one is sufficient.


    I think I found a case where RefreshReport and SetDisplayMode do different things.

    I'm attempting to preview a report that:
    A) Shows parameter prompts
    B) Defaults to PrintLayout & PageWidth
    C) Doesn't show "Report processing cancelled"

    Here is my RDLViewerUI_Load code:

      Private Sub RDLViewerUI_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
        rpvReport.ShowParameterPrompts = True
        rpvReport.SetDisplayMode(DisplayMode.PrintLayout)
        rpvReport.ZoomMode = ZoomMode.PageWidth 
    
      End Sub
    

    When the report renders the parameter prompts are missing, and the button to show parameters is disabled.

    If I add a call to RefreshReport the parameter prompts show up, but now the "report processing cancelled" message comes back.

    Is there some other method I can call that will re-render the parameters pane without re-rendering the report content?

    • Proposed as answer by a2iii2 Friday, October 1, 2010 3:57 PM
    Wednesday, July 21, 2010 6:14 PM