Glossary Item Box

Samples | Walkthroughs

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

Walkthrough: Unbound Reports

ActiveReports gives you complete control to bind reports to any type of data source, including arrays, through its programmable object model. You can create a report without setting the report's data source and load the data from your data source into the report's controls at run time. The Fields property allows data binding between the controls and the run-time fields. It also allows the control's DataField property to be set to any of the run-time defined names. The DataInitialize and FetchData events are used to define the run-time fields and feed the data values of these fields so they can be used with unbound controls.

This walkthrough illustrates the fundamentals of using the DataInitialize and FetchData events to set up an unbound report.

This walkthrough is split 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 an ActiveReport to a Visual Studio project

To add an ActiveReport to your project

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

Adding code to connect the report to a data source

To write the code in Visual Basic

To write the code in C#

Adding code to disconnect the data source

To write the code in Visual Basic

To write the code in C#

Adding controls to the report to contain data

To add controls to the report

Using the DataInitialize event to add fields

To write the code in Visual Basic

To write the code in C#

Using the FetchData event to populate the report fields

To write the code in Visual Basic

To write the code in C#

Note: The DataInitialize and FetchData events are the only events in which the Fields collection should ever be referenced.

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

 

 


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