Step 2. Create your Reusable Part

Next create a reusable part that looks like this:

You will use it on your test form like this:

1.  Create a new reusable part of type panel:

     When the editor is displayed, the reusable part appears as a small panel:

     This reusable part will eventually be embedded into other forms (or other reusable parts). The size that this panel has at the time that you save your reusable part determines the dimensions of the space that your reusable part will occupy on other forms (or in other reusable parts). 

2.  Size the panel and add a combo box to it.

3.  Set the ComboBoxStyle property of the combo box to DropDownList. 

4.  Add columns to the combo box source from fields DEPTMENT (Department Code) and DEPTDESC (Department Description).

5.  Make the DEPTMENT column in the combo box invisible. You only want the description details to be shown (field DEPTDESC). Your reusable part should look like this:

6.  You need to fill the combo box with information. Add an Initialize event routine to your reusable part that fills the combo box with departmental details. For example:


select (#deptment #deptdesc) from_file(deptab)

add_entry #CMBX_1


get_entry number(1) from_list(#CMBX_1)


This code fills the combo box from the DEPTAB file and then ensures that the focus is set to the first entry in the combo box.   

7.  Compile your reusable part. You cannot actually test your component yet. It first has to be embedded inside a form.