ActiveReports 6 Online Help
Bound Data Sample

The Bound Data sample demonstrates the use of seven different data binding techniques. The sample Invoice report demonstrates the use of grouping and of summary functions.

MainForm

The MainForm uses the ActiveReports Viewer control in the bottom section of the form, and a panel docked to the top contains seven 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.

Above the Data Binding Code region is the Drop Down Population Code region that is used to populate the combo boxes on the DataView and SQL Server tabs. The XML tab also features a button that generates a DataSet and saves it as an XML data file.

Run the project and click to select a tab, then click the buttons to check the functionality of each type of data binding as it processes the data, passes it to the report, and displays it in the viewer below.

Invoice

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

Note: Except for the Detail section, all sections come in header and footer pairs. Unused counterparts to the sections in use 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.

This section 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 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 text boxes. Two of the TextBox controls use the following properties to summarize the detail data: SummaryFunc, SummaryGroup, and SummaryType. For more information, see Create Summary Fields.

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

For more information on using Script with ActiveReports, see Scripting.

PageFooter

This section has one simple Label control. Since none of the GroupFooter sections has its PrintAtBottom property set to True, the PageFooter prints at the bottom of each page of the report. For more information about report sections and the order in which they print, see Report Structure and Section Events.