Glossary Item Box

Samples | Walkthroughs | GroupKeepTogether enumeration

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

Walkthrough: Hyperlinks and Bookmarks

ActiveReports allows you to use the hyperlink property to reference back to the bookmarks collection.

This walkthrough illustrates how to add to add hyperlinks to a report which reference items in the bookmarks collection and create a directory to match the items in the bookmarks collection.

This 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 completed this walkthrough, you will have a report that looks similar to the following.

Adding two ActiveReports to a Visual Studio project

To add two ActiveReports to a Visual Studio project

  1. Open a new project in Visual Studio.
  2. Click on Project > Add New Item.
  3. Select ActiveReports file and rename the file rptMain.
  4. Click Open.
  5. Click on Project > Add New Item.
  6. Select ActiveReports file and rename the file rptBookmarks.
  7. Click Open.

Connecting rptMain to a data source

To connect the report to a data source

  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 suppliers order by CompanyName".
  7. Click OK to return to the report design surface.

Adding controls to display the data

To add controls to the reports

  1. Add a GroupHeader/Footer section to rptMain.
  2. Make the following changes to the group header:
    • Change the name to ghSuppliers
    • Change the DataField property to CompanyName
    • Change the GroupKeepTogether property to All
    • Change the KeepTogether property to True
  3. Add the following controls to rptMain's GroupHeader section:

    Control Name Text/Caption Location
    Label lblCompanyName Company Name 0, 0
    Label lblContactName Contact Name 1.562, 0
    Label lblPhone Phone # 2.687, 0
    Label lblFax Fax # 3.812, 0
    Label lblHomePage1 Home Page 4.875, 0

  4. Add the following controls to rptMain's Detail section:

    Control DataField Name Text/Caption Location
    TextBox CompanyName txtCompanyName Company Name 0, 0
    TextBox ContactName txtContactName Contact Name 1.562, 0
    TextBox Phone txtPhone Phone 2.687, 0
    TextBox Fax txtFax Fax 3.812, 0
    TextBox HomePage txtHomePage Home Page 4.854, 0

  5. Add the following controls to rptMain's PageFooter section:

    Control Name Text/Caption Misc Details Location
    Label lblEmail Need Assistance? E-mail Support: Support@company.com HyperLink = mailto:support@company.com 0, 0.125
    Label lblHomePage Visit our home page: www.datadynamics.com HyperLink = www.datadynamics.com 0, 0.375

  6. Add the following controls to rptBookmarks' PageHeader section:

    Control Name Text/Caption Location
    Label lblDirectory Directory 0.5, 0
    Label lblCompanyName CompanyName 1.125, 0.437
    Label lblPage Page 3.312, 0.437
    Line Line1 (Empty string) X1 = 0

    Y1 = 0.697

    X2 = 6.5

    Y2 = 0.697

  7. Add the following controls to rptBookmarks' Detail section:

    Control Name Text/Caption Location
    TextBox txtEntry Company Name 1.125, 0
    TextBox txtPage Page 3.312, 0

Adding the code to rptMain's Detail_Format event

To write the code in Visual Basic

To write the code in C#

Adding the code to rptMain's ReportEnd event

To write the code in Visual Basic

To write the code in C#

Adding the code to rptBookmarks' Detail_Format event

To write the code in Visual Basic

To write the code in C#

Adding code to rptBookmarks' FetchData event

To write the code in Visual Basic

To write the code in C#

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.