Creating Controls by Dragging and Dropping Fields or Tables
You can specify the type of control that is created when you drag a field or table onto a form. For example, you can create a text box control any time a Character field is dragged onto a form.
To map field types to classes
From the Tools menu, choose Options.
Select the Field Mapping tab.
To change a field type mapping, select a line in the Map fields to classes for drag and drop area and choose Modify.
In the Modify Field Mapping dialog box, select a field type from the Type list.
To set the class that is created whenever you drag a table or multiple fields, select Multiple from the Type list.
To select the class library (.vcx file) that contains the control you want to associate with the selected field type, choose Browse.
Select a class name from the Name list. The class you specify here will be created any time a field of the selected type is dragged onto a form.
Choose OK to accept the mapping.
Set options in the Database options area:
To... Select... Create a label in addition to the bound control when you drag a field or table to a form or container Drag and drop field caption Set the Comment property of the bound control to the text specified in the Field Comment box in the Fields tab of the Table Designer Copy field comment Set the InputMask property of the bound control to the input mask specified in the Fields tab of the Table Designer Copy field input mask Set the Format property of the bound control to the format specified in the Fields tab of the Table Designer Copy field format
Note You also can specify classes for dragging and dropping in the Display Class box in the Fields tab of the Table Designer. The settings in the Table Designer override the settings you specify here.
Quickly Creating a Single Control
You can quickly create a single control based on the field type mapping you specified on the Field Mapping tab in the Options dialog box. You also can override the default mapping and create a different class type.
To create a single control
Click on any field in the Data Environment and drag it onto a form.
Note The ControlSource property of the newly created control is set to the Name property of the field.
To create a single control and override the current field mapping
- Right-click on any field in the Data Environment and drag it onto a form.
- From the shortcut menu, select Create Other Control Here.
- In the Open dialog box, choose a Visual Class Library (.vcx) file.
- Select the type of control you want to create from the Class Name box and choose Open.
Quickly Creating Multiple Controls
You can drag an entire table onto a form. By default, a grid control is created when you drag a table onto a form. You can override the default and create multiple controls corresponding to the default field type mappings specified for each field in the table.
To create a grid control
- Choose any table in the Data Environment, Database Designer, or Project Manager and drag it onto a form.
To create multiple controls
- Right-click any table, or two or more highlighted fields in a table, in the Data Environment, Database Designer, or Project Manager, and drag it onto a form.
- From the shortcut menu, select Create Multiple Controls Here.
See Also
Adding Controls to a Wizard-Generated Form | Creating a New Form | Creating Forms with Local and Remote Data | Adding Visual FoxPro Controls to a Form | Data Environment Designer | Creating Forms