Partager via


How to: Set Default Classes for Fields

You can set or change the default class for a field in a database table so that when you drag or add the field to a form, an object instantiates from the default class and appears on the form.

For example, character fields appear as text box controls when you add them to a form. Suppose you wanted to add the field as a combo box control instead of a text box. You can change the default class for the field to the ComboBox base class. You can also specify class libraries that you create.

To set a default class for a field

  1. Open the database containing the table.

  2. Open the table in the Table Designer.

  3. On the Fields tab, select the field that you want.

  4. In the Display class list from the Map field type to classes area, select the default class for the field.

  5. To specify a class library, in the Display library box, type the name of the class library. To browse for and select a class library, click the ellipsis (...) button.

For more information, see Fields Tab, Table Designer.

Tip

If you change the class and class library often for fields, you can map data types to the class and class libraries you want using the Field Mapping tab in the Options dialog box. For more information, see Field Mapping Tab, Options Dialog Box and How to: Create Controls by Dragging and Dropping Fields or Tables.

See Also

Tasks

How to: Open Databases

How to: Edit Table Structure

Other Resources

Working with Fields

Working with Tables (Visual FoxPro)