2.18.1 Dynamic Multi-Form Application

This example differs from the example shown in 2.14 Multi-Form Applications in that a reference is explicitly set to the child form and this reference is destroyed when the child form is closed. This appoach has the benefit of allowing the developer to have control over the life span (and thus the memory usage) of components.

A main form can display a child form showing address information for a selected employee.

The Main Form creates a reference to the Address Form when the Show Address Form button is clicked. When the Address Form is closed, an event is triggered to the Main Form which destroys the reference to the Address Form.