How to identify the current page being printed in PrintProgress Event ?


03-02-2010, 9:27 AM

Hi,

I am working with ActiveReports for .Net  (3.2.0.1966) in a VB.Net project. There is a report displaying one record per page. I need to identify the page being printed ( at run-time ) in order to update the "printed" status of the current register in the database. In other words, I only want to update the records when they have actually been printed. In the Detail_Format event I populate an internal datatable with the current record identifier and the page number, so when printing I would have to be able to get the current page but I don't succeed.

I've tried to add some code in the PrintProgress(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PrintProgress but it doesn't work. Can you help me ? Is there any way to obtain the number or the value of a field in the current page when printing ?

Thanks in advance, Alex.

Re: How to identify the current page being printed in PrintProgress Event ?


03-02-2010, 11:05 PM
Hello,

You can get the current page number which is printing. For this you can either use the PrintProgress event as shown in the following code:

Dim j As Integer = 1
Private Sub rptGreenBar_PrintProgress(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.PrintProgress
System.Diagnostics.Debug.WriteLine("CurrentPage: " + j.ToString())
        j = j + 1
End Sub


Or you can use the interop assembly to take full control of the printer. This lets you add any functionality you need. To know more about this you can click here.

Do let us know if you need further assistance.

Regards,
Ankit Nigam