Link to home
Start Free TrialLog in
Avatar of RubenvdLinden
RubenvdLinden

asked on

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

Avatar of SwissKnife
SwissKnife
Flag of Switzerland image

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
Avatar of RubenvdLinden
RubenvdLinden

ASKER

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

ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
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.
I'm glad I can stop searching for a solution which does not exists. Thank you for your time.