Condividi tramite


Setting Control Properties

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

  1. From the Tools menu, choose Options.

  2. Select the Field Mapping tab.

  3. To change a field type mapping, select a line in the Map fields to classes for drag and drop area and choose Modify.

  4. 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.

  5. To select the class library (.vcx file) that contains the control you want to associate with the selected field type, choose Browse.

  6. 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.

  7. Choose OK to accept the mapping.

  8. 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

  1. Right-click on any field in the Data Environment and drag it onto a form.
  2. From the shortcut menu, select Create Other Control Here.
  3. In the Open dialog box, choose a Visual Class Library (.vcx) file.
  4. 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

To create multiple controls

  1. 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.
  2. 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