ActiveReports for .NET 3 Online Help Request technical support
Section Events
See Also
User Guide > Concepts > Section Events

Glossary Item Box

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-raising sequence must be dynamic in order to accommodate individual report demands.

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 is raised 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 is raised 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 is raised. Use this section to resize any controls if needed.

Since all controls and section growth have already taken place by the time this event is raised, the 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 is raised 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.

See Also

©2009. All Rights Reserved.