ActiveReports for .NET 3 Online Help Request technical support
Green Bar Reports
See Also
User Guide > Samples and Walkthroughs > Walkthroughs > Standard Edition Walkthroughs > Basic > Green Bar Reports

Glossary Item Box

Green bar printouts can be created by alternating the shading or background color of the report's Detail section in the Format event.

This walkthrough illustrates how to create a green bar report.

The walkthrough is split up into the following activities:

To complete the walkthrough, you must have access to the Northwind database.
A copy is located at C:\Program Files\Data Dynamics\ActiveReports for .NET 3.0\Data\NWIND.MDB.

When you have finished this walkthrough, you will have a report that looks similar to the following.

Creating a new Visual Studio project

To create a new Visual Studio project

  1. Open Visual Studio.
  2. From the File menu, select New > Project.

  3. Select the project type and click Windows Application.
  4. Change the name of your project and click OK.

Adding an ActiveReport to a Visual Studio project

To add an ActiveReport to your project

  1. Open a new project in Visual Studio.
  2. From the Project menu, select Add New Item.
  3. Select ActiveReports 3.0 File and rename the file rptGreenBar.
  4. Click Open.

Connecting the data source to a database

To connect the data source to a database

  1. Click on the gray report DataSource icon in the Detail section to open the Report Data Source dialog.
  2. Select the "OLE DB" tab.
  3. Click Build.
  4. Select "Microsoft Jet 4.0 OLE DB Provider" and click Next.
  5. Click the ellipsis button to browse for the access path to the Northwind database. Click Open once you have selected the appropriate access path.
  6. Click OK to continue.
  7. In the Query field, type "SELECT * FROM Products".
  8. Click OK to return to the report design surface.

Adding controls to contain data

To add controls to the report

  1. Set the CanShrink property of the Detail section to True.
  2. In the Report Explorer, expand the Fields node, then the Bound node. Drag the following fields onto the detail section and set the properties of each textbox as indicated.
    Field Text Location
    ProductID Product ID 0, 0
    ProductName Product Name 0.9, 0
    UnitsInStock Units in Stock 3.5, 0
    UnitsOnOrder Units on Order 4.5, 0
    ReorderLevel Reorder Level 5.6, 0
  3. Set the CanShrink property of the PageHeader section to True.
  4. Add the following controls to the PageHeader section:
    Control Name Text Formatting Location
    Label lblTitle Reorder Sheet Font 14pt; Bold; Center 0, 0
    Label lblProductID Product ID Underline 0, 0.37
    Label lblProductName Product Name Underline 0.9, 0.37
    Label lblUnitsInStock Units in Stock Underline 3.5, 0.37
    Label lblUnitsOnOrder Units on Order Underline 4.5, 0.37
    Label lblReorderLevel Reorder Level Underline 5.6, 0.37

Adding code to the detail format event to alternate colors

To write the code in C# or Visual Basic

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 Windows Form Viewer for help.
You can quickly view your report at design time by clicking the Preview tab at the bottom of the designer.

See Also

©2009. All Rights Reserved.