VFW072 Create a Department Dropdown Reusable Part

VLF Windows Application Development

VFW072 – Create a Department Dropdown Reusable Part

In an earlier exercise, you added a Combo box for departments to the Employee Details component, by adding it directly into the logic of the command handler. Clearly this approach would not be the best one from a maintenance point of view, and does not contribute to simplifying or re-using code.

A reusable part provides a component which can be used to create common application components, such as a department's dropdown list, which can be developed once, and then widely re-used throughout the application.

Objective

  • To create a reusable part (RP)which manages a combo box (or dropdown) containing a list of all valid departments.
  • To populate the RP combo box from the table DEPTAB.
  • The 'Department Dropdown' RP will publish a property which enable its current department code to be set, or for another component to get its current value.
  • When the current department property is set, the Department Dropdown RP will position the combo box to the new value.
  • The 'Department Dropdown' reusable part will publish an event, which it will signal when the selected department has changes.

To meet these objectives, you will complete the following:

Step 1. Create Department Dropdown Reusable Part

Step 2. Make the Reusable Part Useful

Step 3. Add Department Dropdown to Employee Details command handler

Step 4. Complete Command Handler to use Department Dropdown

Summary

Before You Begin

Complete exercises VFW04, VFW05, VFW06.