cancel
Showing results for 
Search instead for 
Did you mean: 

CrystalReportViewer AfterRender Event?

Former Member
0 Kudos

We just migrated our application from VS.NET 2003 to VS.NET 2005.

Previously, we had a small dialog Show() with a timer (to show it's still processing) and a "Please want..." label.

Then we would open a form with a CrystalReportViewer control in the background. We had it disabled and minimixed.

Once Show() returned control, it would maximize the finished report and would bring the window to the front, closing the little "Please wait" window.

This allowed us to have a visible progress on report generation, especially those that ran for a minute or greater via our stored procedures.

Migrating to VS.NET 2005 broke this. Apparently as soon as CrystalReportViewer.ReportSource is set and we tell it to Show(), it will display the form before the report finishes, and return control immediately. This closes our waiting window instantly and leaves a big blank report sitting in front of the user for up to a minute.

Apparently, Crystal Reports 10 has no event that fires once a report has finished rendering. I found one available within CR11 and VS.NET 2008 titled AfterRender, but I don't even know if that will work.

So my question is--what could I possibly use to verify a report has been fully rendered/generated?

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos
Former Member
0 Kudos

I don't need a progress bar, per se, just need to know when the report is done.

So then I can Close() our waiting form and maximize/bring to front the report form. Or at least get something similar going.

This was never an issue, due to the silly way Show() waited for the CrystalReportViewer to complete rendering the report. Now it doesn't and I can't think of a way short of generating the report and exporting it to disk, then just showing that instead.

0 Kudos

Hi Adam,

Can you explain or post the code you were using to test when the reprot was done, as in how do your little message box get told the reprot was finished?

Only functionality we had to get that info was using the progress indicator which they broke in CR 10 and never fixed for various reasons they could not.

Thank you

Don

Answers (2)

Answers (2)

Former Member
0 Kudos

Okay, figured it out on accident.

Show() no longer keeps control unless you set the WindowState property to Maximized before calling it. Now the window will wait to render the full ReportViewer control before returning control to the function that called the Form's Show() method.

Not a real solution, but it works.

To anyone that is having this problem, the semi-solution is:


Dim frm As New frmViewReport 'Form that contains the ReportViewer control
frm.crView.ReportSource = report 'Where report is a ReportDocument object and crView is the ReportViewer
frm.WindowState = Maximized
frm.Show()
foo() 'This will not execute until the report is fully rendered in frm.crView

Edited by: Adam Flanczewski on Oct 7, 2008 7:36 PM

Former Member
0 Kudos

The main code was simply this:


Dim frmW As New frmWait
frmW.Show()
frm.crView.ReportSource = frm.rptDoc
frm.Enabled = False
frm.WindowState = FormWindowState.Minimized
frm.Show()
frmW.tmrMain.Enabled = False
frmW.Dispose()
frmW = Nothing
Me.Cursor = Cursors.Default
frm.Enabled = True
frm.WindowState = FormWindowState.Maximized
frm.crView.Zoom(1)

Where frmWait is nothing but a tiny form with the words "Please wait..." and a simple timer that shows the minutes/seconds the report has been running.

And where frmViewReport (defined as 'frm') is nothing more than a form with with a CrystalReportViewer defined as 'crView' and a ReportDocument defined as 'rptDoc'.

This code would, in VS.NET 2003, open frmW, open frm, wait for frm to finish generating the report, then frmW would Close() and frm would maximize.

This gave the effect of a nice progress timer/window for the report being generated by the application.

Now, it no longer waits for returned control at frm.Show() as it used to.

It opens frmW, opens frm, minimizes it, frmW instantly disappears, and frm maximizes and sits there with a blank report as it works on rendering/generating it.

0 Kudos

Hi Adam,

Are you using .NET framework 1.1 or 2.0? And which CR assemblies are you using, 1100 or 2000?

It may be a limitation in the 2.0 framework. We've seem other issues that MS has alter the way various dialog boxes and other back group process have changed making Cr not work as it did when using the 1.1 framework.

Thanks again

Don

Former Member
0 Kudos

Well, we moved from Visual Studio .NET 2003 to 2005, so it's .NET 2.0.

The assembly is version 10.2.3600.0 runtime v2.0.50727.

And it's less of a "limitation" as it is a framework improvement. As it stands, the Show() method of TextBox objects appears to thread out its processing instead, instead of waiting for different controls to render, etc.