如何使用ReportViewer.PrintDialog() [英] How to use ReportViewer.PrintDialog()

查看:263
本文介绍了如何使用ReportViewer.PrintDialog()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在尝试使用ReportViewer1.PrintDialog()而不是ReportViewer1.Refreshreport()
我的意思是将报告带给打印机,而不是查看报告.



但是,当我运行代码时,它会生成错误. 由于对象的当前状态,该操作无效."
请告知是什么问题?
谢谢
Furqan

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

推荐答案

它会生成错误. 由于对象的当前状态,该操作无效."
这是因为报告仍在呈现,而您正在尝试将其打印出来.

您需要等待渲染完成.有一个事件RenderingComplete,您可以使用它来避免它.

看一下这个线程:在此讨论的类似讨论 [ ^ ]


更新:
刚刚找到另一个线程 [ ^ ]确认我的答案.
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.


这篇关于如何使用ReportViewer.PrintDialog()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆