[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'DB' (#fcl)

# TFieldDef.CreateField

Create TField instance based on definitions in current TFieldDef instance.

## Declaration

Source position: db.pas line 189

`public function TFieldDef.CreateField(`
`AOwner: TComponent`
`):TField;`

## Arguments

`AOwner` |  | Owner for the new TField instance.

## Function result

Instance of TField corresponding to the field definition

## Description

CreateField determines, based on the DataType what TField descendent it should create, and then returns a newly created instance of this class. It sets the appropriate defaults for the Size, FieldName, FieldNo, Precision, ReadOnly and Required properties of the newly created instance. It should never be necessary to use this call in an end-user program, only TDataset descendent classes should use this call.

The newly created field is owned by the component instance passed in the AOwner parameter.

The DefaultFieldClasses array is used to determine which TField Descendent class should be used when creating the TField instance, but descendents of TDataset may override the values in that array.

## See also

DefaultFieldClasses |  | Default field classes to use when creating a new TField instance.
TField |  | Provide access to the contents of a single field in a record