EnriqueM

Hi.

How do I know when/if the report has been printed Which is the event to hook Basically, I need to update a table

with the date when the report was printed and the user who printed it.

When I click print on the toolbar of the ReportViewer, I am sent to the print dialog. How do I know if the user chose to print it or cancel it

Thanks very much for any help,

Enrique



Re: Visual Studio Report Controls Newbie: How do I know when/if the report has been printed

eldelo

I've not tried plugging into a printing cycle in the RV, however...

There is a "Print" event on the reportviewer that is fired (callback that is called) when the user chooses to print. Not sure if that happens before, during, or after the print, but it at least signals that a print activity has been initiated, is in process, or has completed. So that's a start.

With a little experimentation you ought to know whether or not that will work for you, and you might discover something along the way as well...

- Lance






Re: Visual Studio Report Controls Newbie: How do I know when/if the report has been printed

EnriqueM

Hi Delo.

Thanks for your answer. Unfortunately, the Print event gets fired before the Print dialog appears, so the user can cancel the

printing(so, even though I get the print event, no printing takes place).

What I really need to know is if there is anything, any way to find out what happened with the report.

Other reporting tools have something like "Report.Document.Printer.EndPrint", an event that gets fired when the last page

of the report is printed.

Is there anything similar in the ReportViewer/ Reporting Services

Thanks for your help,

Enrique





Re: Visual Studio Report Controls Newbie: How do I know when/if the report has been printed

eldelo

Sorry, I'm out of ideas...

I don't see any other events that seem relevant.

I guess at some point if the user prints the report then it ends up as a print job in their print queue (relatively quickly, one might hope, but that's not always a valid assumption.)

And now that I think about it, even if the reportviewer did fire a ReportPrinted() (or some such) event, all that would tell you is that the job queued without generating an exception etc.

Looked at from that perspective, it's not really in the ReportViewer's control to say whether it was printed or not... rather just that the rv successfully queued a print job (a ReportQueuedToPrinterQueue() event )

So... one possible solution might be to create a printqueuewatcher thread started by the Print() event and that watches the print queue... But I've not done that and it's not necessarily an elegant solution. For all I know it'd end up a hairball of frail code and event chains and so on.






Re: Visual Studio Report Controls Newbie: How do I know when/if the report has been printed

eldelo

FWIW I do think it'd be nice if the reportviewer at least fired an event at the end of it's enqueueing activities, but apparently it does not...