We help IT Professionals succeed at work.

How can I show the progress of the CrystalReportViewer in C#?

I have a small client application written in C# (Visual Studio 2003), which contains a CrystalReportViewer component to display some reports.
The database has grown over the years and now it takes several minutes before these reports are displayed. My customers have complained that during the execution of a report, it's not very clear if the program is still running.

I tried to include the WaitCursor (see the code sample), but as soon as the Crystal Reports Database Login appears the cursor is normal again.
Is there any way to have either a WaitCursor or some kind of progressbar during the execution of the report?
string workDir = System.IO.Directory.GetCurrentDirectory();
 
this.Cursor = Cursors.WaitCursor;
			
if (rbOE.Checked)
{
	crv.ReportSource = workDir + @"\Sectieoverzicht.rpt";
}
 
else
{
	crv.ReportSource = workDir + @"\Geaggregeerd Sectieoverzicht PSA.rpt";
}
 
this.Cursor = Cursors.Default;

Open in new window

Comment
Watch Question

Hello RubenvdLinden

I think, you do all in one step.

May be you can show the wait cursor if you break up the loading and displaying as described in the linked article:
http://www.c-sharpcorner.com/UploadFile/mahesh/CrystalReportsViewer11082005044859AM/CrystalReportsViewer.aspx

Author

Commented:
Thank you for your response. I have changed my code and now it uses a ReportDocument object as the ReportSource.
Unfortunately, I get the same results.

Is there some kind of event that is triggered whenever a report is loaded? It might be of use to me.


this.Cursor = Cursors.WaitCursor;
			
if (rbOE.Checked)
{
		//crv.ReportSource = new Reports.Sectieoverzicht();
		//crv.ReportSource = workDir + @"\Sectieoverzicht.rpt";
		doc.Load(workDir + @"\Sectieoverzicht.rpt");
}
 
else
{
		//crv.ReportSource = new Reports.Geaggregeerd_Sectieoverzicht_PSA();
		//crv.ReportSource = workDir + @"\Geaggregeerd Sectieoverzicht PSA.rpt";
		doc.Load(workDir + @"\Geaggregeerd Sectieoverzicht PSA.rpt");
}
			
crv.ReportSource = doc;
			
this.Cursor = Cursors.Default;

Open in new window

Senior Consultant
SILVER EXPERT
Most Valuable Expert 2011
Top Expert 2013
Commented:
As far as I know there is no event that indicates load is complete.  This has been asked many times in different ways and there has been no solution.

mlmcc

Author

Commented:
Thanks for the responses.
I will try if the WaitCursor works if I manually program the reportlogon to the database rather than using the Crystal Reports dialog.

Author

Commented:
I tried to logon the report to the database through code, but again the WaitCursor changed into the DefaultCursor as soon as the logon succeeded.

If I do not receive any other suggestions this week, I will accept the answer of mlmcc. In this case "There is no solution" might be the correct answer.

Author

Commented:
I'm glad I can stop searching for a solution which does not exists. Thank you for your time.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.