Glossary Item Box

Report Execution | Firing Sequence of Events

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

Events

ActiveReports Section Events

In a report, regardless of the type or content of the various sections, there are three events for each section: Format, BeforePrint and AfterPrint.

Because there are many possible report designs, the event-firing sequence must be dynamic in order to accommodate individual report demands.

Out of the three events, the Format event generally is used the most often, followed by the BeforePrint event and, in rare circumstances, the AfterPrint event.

Note: You should never reference the report's Fields collection in these section events. The DataInitialize and FetchData events are the only events in which the Fields collection should ever be referenced.

Format event

This event fires after the data is loaded and bound to the controls contained in a section, but before the section is rendered to a page.

The Format event is the only event where the section's height may be changed. This section may be used to set or change the properties of any controls or load subreport controls with subreports.

If the CanGrow or CanShrink property of any control contained within a section, or the section itself, is set to True, all of the growing and shrinking of controls contained in this section, and the section itself, takes place in the Format event. Because of this, information about a control or a section's height cannot be obtained in this event.

BeforePrint event

This event fires before the section is rendered to the page.

The growing and shrinking of the section and all controls contained in a section have already taken place by the time this event fires. Use this section to resize any controls if needed.

Since all controls and section growth have already taken place by the time this event fires, this event may be used to get an accurate height of the section, or, if needed, any controls contained in it. Any controls in the BeforePrint event may be resized but not the height of the section itself.

AfterPrint event

This event fires after the section is rendered to the page.

Although AfterPrint was an important event prior to ActiveReports Version 1 Service Pack 3, it is rarely used in any of the newer builds of ActiveReports. When you place code in the section events, you likely will place your code in either the Format event or the BeforePrint event. This event is still useful for drawing on the page after text has already been rendered to the page.

Report Execution | Firing Sequence of Events

 

 


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