DevExpress - Xtra Reports: VB.NET How to get current page number?
-
08-07-2019 - |
Question
I've searched their site. I just want to find the page number in the vb script. I have a report header, and if it is on page #1 then I want a page break after.
Solution
This code should do the trick. It's the PrintOnPage event handler for a label in your Report Header.
Private Sub xrLabel1_PrintOnPage(ByVal sender As Object, ByVal e As DevExpress.XtraReports.UI.PrintOnPageEventArgs) Handles xrLabel1.PrintOnPage
If e.PageIndex > 0 Then
ReportHeader.PageBreak = DevExpress.XtraReports.UI.PageBreak.None
Else
ReportHeader.PageBreak = DevExpress.XtraReports.UI.PageBreak.AfterBand
End If
End Sub
Note that the PageIndex value is zero-indexed. Also, the page index is only available (as far as I know) in the PrintOnPageEventArgs, so this won't work in a Before/AfterPrint event.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow