Glossary Item Box

Samples | Walkthroughs | GroupKeepTogether enumeration

See Also ActiveReports for .NET 2 Online Help Send feedback to Data Dynamics

Walkthrough: Page Numbering in the Group Header

With ActiveReports, page numbering can be easily applied to groups in a report using the GroupHeader section.

This walkthrough illustrates the basics of setting up page numbering for groups in the GroupHeader section.

The walkthrough is split up into the following activities:

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

  1. Click on Project > Add New Item....
  2. Select ActiveReports File and rename it rptNumberGH.
  3. Change the name of the report and click Open.
  4. The ActiveReports design surface is displayed.

Connecting the data source to a database

To connect the data source to a database

  1. Click on the yellow report DataSource icon in the Detail section. This brings up the report DataSource dialog box.
  2. Click on Build...
  3. Select "Microsoft Jet 4.0 OLE DB Provider" and click Next >>.
  4. Click on the ellipsis to browse for the access path to Nwind.mdb. Click Open once you have selected the appropriate access path.
  5. Click OK to continue.
  6. In the Query field, type "Select * from customers order by country".
  7. Click OK to return to the report design surface.

Adding controls to contain data

To add controls to contain data

  1. Add a GroupHeader/Footer section to rptNumberGH.
  2. Make the following changes to the group header:
    • Change the name to ghCustomers
    • Change the DataField property to Country
    • Change the GroupKeepTogether property to FirstDetail
    • Change the KeepTogether property to True
  3. Add the following controls to the GroupHeader section:

    Control Name Text/Caption Misc Details Location
    Label lblPage Page (Empty string) 0, 0
    Label lblOf Of (Empty string) 0.75, 0
    TextBox txtPageNumber # SummaryType = PageCount

    SummaryRunning = Group

    SummaryGroup = ghCustomers

    0.5, 0
    TextBox txtPageCount ## SummaryType = PageCount

    SummaryGroup = ghCustomers

    1, 0
    Label lblCustomerID CustomerID (Empty string) 0, 0.25
    Label lblCompanyName CompanyName (Empty string) 1.1875, 0.25
    Label lblAddress Address (Empty string) 3.3125, 0.25
    Label lblCountry Country (Empty string) 5.125, 0.25

  4. Add the following controls to the Detail section:

    Control DataField Name Text/Caption Location
    TextBox CustomerID txtCustomerID CustomerID 0, 0
    TextBox CompanyName txtCompanyName CompanyName 1.1875, 0
    TextBox Address txtAddress Address 3.3125, 0
    TextBox Country txtCountry Country 5.114, 0

Viewing the report

To view the report

  1. Add the ActiveReports viewer control to a Windows Form.
  2. Add the code needed to set the viewer document equal to the report document. See Using the ActiveReports WinForm Viewer for help.

Samples | Walkthroughs | GroupKeepTogether enumeration

 

 


Copyright © 2004-2005 Data Dynamics, Ltd. All rights reserved.