Vcl.DBGrids.TCustomDBGrid.Fields

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property Fields[FieldIndex: Integer]: TField read GetFields;

C++

__property Data::Db::TField* Fields[int FieldIndex] = {read=GetFields};

Properties

Type Visibility Source Unit Parent
property public
Vcl.DbGrids.pas
Vcl.DBGrids.hpp
Vcl.DBGrids TCustomDBGrid

Description

Provides indexed access to the field components that correspond to the columns.

Use Fields to gain direct access to the field component in the dataset for a particular column in the grid. The field for the first data column is obtained using an Index of 0, the field for the second data column using an Index of 1, and so on. The range for Index is 0... FieldCount - 1.

The first data column in the grid may not be the same as the first column in the grid. If Options includes dgIndicator, the first column in the grid is a non-scrolling column that contains the current row indicator.

The individual field components in Fields can be used to obtain information such as the value of the field on the current record, its preferred display width, or the string to draw when displaying or editing the field. Use the field component to write values directly to the dataset without using the editor in the cell.

Note: If the column in the grid represents a calculated field, there is no field component for that column in the dataset. Fields returns nil (Delphi) or NULL (C++) when the Index specifies the column that contains a calculated field. To obtain the field component for a calculated field, use the GetColField method.

See Also