ComponentOne Reports for WinForms Designer Edition: ComponentOne Reports for WinForms > Getting Started with Reports for WinForms > Getting Started with Reporting > Creating VBScript Expressions > Resetting the Page Counter

Resetting the Page Counter

The C1Report.Page variable is created and automatically updated by the control. It is useful for adding page numbers to page headers or footers. In some cases, you may want to reset the page counter when a group starts. For example, in a report that groups records by country. You can do this by adding code or using the Designer.

Using Code:

To reset the page counter when a group (for example, a new country) starts, set the PageFooter field's Text property. Enter the following code:

      Visual Basic

C1Report1.Fields("PageFooter").Text = "[ShipCountry] & "" "" & [Page]"

      C#

c1Report1.Fields("PageFooter").Text = "[ShipCountry] + "" "" + [Page]";

Using the C1ReportDesigner:

To reset the page counter when a group (for example, a new country) starts, set the PageFooter field's Text property by completing the following steps:

1.   Select the PageFooter's page number field from the Properties window drop-down list in the Designer or select the field from the design pane. This reveals the field's available properties.

2.   Click the box next to the Text property, then click the drop-down arrow, and select Script Editor from the list.

3.   In the VBScript Editor, simply type the following script in the window:

[ShipCountry] & " -  Page " & [Page]

4.   Click OK to close the editor.


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.