Shortcut: you can also double-click on the grid. To create persistent columns, select the grid component in the form and next double click on the Columns property in the Object Inspector. Persistent column objects are set up at design time, i.e. On the other hand, if the dataset has persistent field components, they exist even when the dataset is closed: the columns associated with those fields retain their properties when the dataset is closed.
All dynamic columns are destroyed as well. The dynamic field components are destroyed each time the dataset is closed. The order of columns in the grid matches the order of fields in the dataset, and the display of data is determined by the properties of the fields in the dataset. In that case, the grid columns are dynamically generated from the fields of the dataset. Each Column has properties that define how the column will look like.īy default, the grid has no persistent column objects. This article focuses on the use of the TClientDataSet component, mapped to a local file.Ī DBGrid has a Columns property. The DBGrid also lets you edit, add and delete records, and it lets you scroll and navigate. With a DBGrid you visualize the contents of a DataSet. In this column, we have a detailed look at the TDBGrid component.