Load time of reportviewer

John Cassell

Well-known member
Joined
Mar 20, 2007
Messages
65
Programming Experience
Beginner
Hi,

Would someone be able to tell me how to display the time it has taken for a report to run to the user pls.

I was using this code:

VB.NET:
 Private Sub Run_Report_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Run_Report.Click
        Dim reportstart = Now
        Me.ReportViewer1.RefreshReport()
        Rep_Time.Text = "Report Load Time: " & FormatNumber(DateDiff(DateInterval.Second, reportstart, Now), 2)
    End Sub

but this gives a value of 1 second no matter how long it has actually taken. It seems to be populating my label 'Rep_Time' with a value immediately after the report has started rather than when it has actually finished.

Any ideas?

Thanks

John
 
I don't think this is possible. I remember a post long ago about someone wanting to add a progressbar to their report to show where it is in terms of loading, but it's not achievable because there's no way of telling when a report starts to load and when it has finished.

I think you are getting 1 sec because it's not recording how long the report takes to load the data. Instead it just times how long it takes to open the report viewer, and rounds up to the nearest second.

there may be ways, it was something I was interested in a while ago, but then I figured out another way to do reporting, and my report load speeds increased a lot...
 
Hi Arg, thanks for the reply. I have actually found a way to do this..

Run Report..
VB.NET:
 Private Sub Run_Report_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Run_Report.Click
Me.ReportViewer1.RefreshReport()
End Sub
Know when the report has finished...
VB.NET:
 Private Sub ReportViewer1_RenderingComplete(ByVal sender As Object, ByVal e As Microsoft.Reporting.WinForms.RenderingCompleteEventArgs) Handles ReportViewer1.RenderingComplete
msgbox"Report Complete"   
  End Sub

But I am very interested to know the other way you do reporting, would you mind filling me in on this pls..

Thanks

John
 
I don't think it's anything fancy, but with the Crystal Reports in VB.net, I use to have a seperate "reports dataSet", and any report was linked to this - so basically I had to fill tables within a dataSet for viewing the data and then fill dataTables within a dataSet to get the report.
Depending on the data, I found that sometimes this took a while.

I then changed it so the report just points to the dataSet that already has the data loaded. Found this improves the loading time on the reports.....

I was probably doing it wrong in the first place anyway :)
 
Ahh right, I think my standard reportviewer works ok then. The TB is filled (which takes time depending on how much data) and then the actual report is loaded really quickly.
 
Back
Top