ActiveReports 11
Bound Data
ActiveReports 11 > ActiveReports User Guide > Samples and Walkthroughs > Samples > Section Report > Data > Bound Data

The Bound Data sample demonstrates various ways to bind data in a section report.

When you run the sample, the Viewer control displays the form with eight tabs, each with a different data binding technique. Click to select a tab, and then click the Bind To button to create the report.

Sample Location

Visual Basic.NET

<User Folder>\Documents\GrapeCity Samples\ActiveReports 11\Section Reports\Data\BoundData\VB.NET

C#

<User Folder>\Documents\GrapeCity Samples\ActiveReports 11\Section Reports\Data\BoundData\C#

Run-Time Features

The top panel of the MainForm is composed of eight tabs:

Bind to DataSet
Creates a DataSet from the sample database and binds it to a SectionReport object.

Bind to DataReader
Creates a DataReader from the sample database and binds it to a SectionReport  object.

Bind to DataView 
Creates a DataView from the sample database and binds it to a SectionReport object.  This tab contains a ComboBox which lets you choose the company name from the NWind database.

Bind to DataTable 
Creates a DataTable from the sample database and binds it to a SectionReport object.

Bind to SQL Server
Creates a SQL Server DataSource from a SQL server instance and binds it to a SectionReport object. The ComboBox present in this tab lets you populate the dropdown list with the existing SQL servers on the network.

Bind to OleDb
Creates an Oledb DataSource and binds it to a SectionReport object.

Bind to XML 
Creates a XML DataSource from a file and binds it to a SectionReport object. The XML tab also features a Generate XML button that generates a DataSet and saves it as an XML data file. The generated file is then used as a data source for the report.

Bind to CSV
Creates a CSV DataSource from a file and binds it to a SectionReport object. You can select the data type of the file from the following options:

Project Details

MainForm

The MainForm uses the ActiveReports Viewer control in the bottom section of the form, and a panel docked to the top contains tabs, each with a different data binding technique.

Click to select a tab, and then double-click the button on the tab to jump to the button's Click event in the code.

Invoice Report

The Invoice report uses three GroupHeader sections, a Detail section and a GroupFooter section as well as a label in the PageFooter section to display data.

Note: Except for the Detail section, all sections come in header and footer pairs. Unused sections have their Height properties set to 0 and their Visible properties set to False.

ghOrderHeader

The DataField property of this section is set to OrderID. This setting, in conjunction with data ordered by the OrderID field, causes the report to print all of the information for one order ID value, including all of the related details and footers, before moving on to the next order ID. For more information on grouping, see Grouping Data in Section Reports.

This section also contains a Picture control, a number of Label controls, and two bound TextBox controls. The TextBoxes are bound using the DataField property in the Properties window, and the date is formatted using the OutputFormat property.

ghOrderID

The DataField property of this section is also set to OrderID. This allows subtotal summary functions in the related GFOrderID section to calculate properly.

This section contains a number of labels and bound text boxes, as well as two Line controls.

ghTableHeader

This section contains only labels for the data to follow in the Detail section.

Detail

This section contains bound TextBox controls. These TextBoxes render once for each row of data found in the current OrderID before the report moves on to the GroupFooter sections.

GFOrderID

The NewPage property of this section is set to After. This causes the report to break to a new page and generate a new invoice after this section prints its subtotals.

This section contains several labels and several TextBoxes. Two of the TextBox controls use the following properties to summarize the detail data: SummaryFunc, SummaryGroup, and SummaryType. For more information, Create a Summary Report.

The Total TextBox does not use the DataField property or any of the summary properties, or even any code. To find the functionality of this TextBox, in design view, click the Script tab at the bottom of the report.

PageFooter

This section has one simple Label control. For more information about report sections and the order in which they print, see Section Report Structure and Section Report Events.

ProductList Report

The ProductList report uses the Header and Detail sections to display data.

The Header section contains a number of Label controls to display column names for the product list.

The Detail section contains four TextBox controls to fetch the product data.

See Also

How To

Concepts