Walkthrough: Page Numbering in the Page Footer
With ActiveReports, page numbering can be easily applied to a report using the PageFooter section.
This walkthrough illustrates the basics of setting up page numbering in the PageFooter section.
The walkthrough is split up into the following activities:
- Adding an ActiveReport to a Visual Studio project
- Connecting the data source to a database
- Adding controls to the report to contain data
- Viewing the report
To complete the walkthrough, you must have access to the NorthWind database (Nwind.mdb).
When you have finished this walkthrough, you will have a report that looks similar to the following.

Adding an ActiveReport to a Visual Studio project
To add an ActiveReport to your project
- Click on Project > Add New Item....
- Select ActiveReports File and rename it rptNumberPF.
- Change the name of the report and click Open.
- The ActiveReports design surface is displayed.
Connecting the data source to a database
To connect the data source to a database
- Click on the yellow report DataSource icon in the Detail section. This brings up the report DataSource dialog box.
- Click on Build...
- Select "Microsoft Jet 4.0 OLE DB Provider" and click Next >>.
- Click on the ellipsis to browse for the access path to Nwind.mdb. Click Open once you have selected the appropriate access path.
- Click OK to continue.
- In the Query field, type "Select * from products order by categoryID".
- Click OK to return to the report design surface.
Adding controls to contain data
To add controls to contain data
- Add a GroupHeader/Footer section to rptNumberPF.
- Make the following changes to the group header:
- Change the name to ghProducts
- Change the DataField property to categoryID
- Change the GroupKeepTogether property to All
- Change the KeepTogether property to True
- Add the following controls to the GroupHeader section:
| Control |
Name |
Text/Caption |
Location |
| Label |
lblProductID |
Product ID |
0, 0 |
| Label |
lblProductName |
Product Name |
1.1875, 0 |
| Label |
lblUnitsInStock |
Units In Stock |
3, 0 |
| Label |
lblUnitPrice |
Unit Price |
4.375, 0 |
- Add the following controls to the Detail section:
| Control |
DataField |
Name |
Text/Caption |
Misc Details |
Location |
| TextBox |
ProductID |
txtProductID |
Product ID |
(Empty string) |
0, 0 |
| TextBox |
ProductName |
txtProductName |
Product Name |
(Empty string) |
1.1875, 0 |
| TextBox |
UnitsInStock |
txtUnitsInStock |
Units In Stock |
(Empty string) |
3, 0 |
| TextBox |
UnitPrice |
txtUnitPrice |
Unit Price |
OutputFormat = Currency |
4.375, 0 |
- Add the following controls to the PageFooter section:
| Control |
Name |
Text/Caption |
Misc Details |
Location |
| Label |
lblPage |
Page |
(Empty string) |
0, 0 |
| Label |
lblOf |
Of |
(Empty string) |
0.625, 0 |
| TextBox |
txtPageNumber |
# |
SummaryType = PageCount
SummaryRunning = All |
0.447, 0 |
| TextBox |
txtPageCount |
## |
SummaryType = PageCount |
0.875, 0 |
Viewing the report
To view the report
- Add the ActiveReports viewer control to a Windows Form.
- Add the code needed to set the viewer document equal to the report document. See Using the ActiveReports WinForm Viewer for help.
Samples | Walkthroughs | OutputFormat Strings
Copyright © 2004-2005 Data Dynamics, Ltd. All rights reserved.