Reputation: 4997
I am trying to use ReportViewer1.PrintDialog() instead of ReportViewer1.Refreshreport() I mean to take my report to printer, instead of viewing it.
But when I run the code, it generates error.
The error is
Operation is not valid due to the current state of the object.
Please advise what is the problem? Thanks Furqan
Upvotes: 2
Views: 3497
Reputation: 18656
It might be because the report is already in the process of rendering when you call PrintDialog(). You have to wait for the rendering to complete in order to avoid this error. You can use the RenderComplete method to detect when the report is done rendering and it is safe to call PrintDialog().
Upvotes: 1