Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Hi,
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. "Operation is not valid due to the current state of the object."
Please advise what is the problem?
Thanks
Furqan
Posted
Updated 27-Feb-11 6:28am
v2

1 solution

it generates error. "Operation is not valid due to the current state of the object."
This is because the report is still rendering and you are trying to print it out.

You need to wait thill the rendering finishes. There is an event RenderingComplete, that you can use to avoid it.

Have a look at this thread: Similar discussion discussed here[^]


UPDATE:
Just found another thread[^] confirming my answer.
 
Share this answer
 
v2
Comments
Furqan Sehgal 28-Feb-11 2:41am    
Thanks Sandeep, it helps !
Sandeep Mewara 28-Feb-11 9:20am    
Good to know it helped.
Espen Harlinn 28-Feb-11 11:53am    
My 5
Sandeep Mewara 1-Mar-11 7:02am    
Thanks Espen. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900