Previous Topic

Next Topic

Inhoudsopgave

Book Index

TDBGrid Control

TDBGrid

Description

Displays and manipulates records from a dataset in a tabular grid.

Remarks

Put a TDBGrid control on a form to display and edit the records from a database table or query. Applications can use the data grid to insert, delete, or edit data in the database, or simply to display it. At runtime, users can use the database navigator (TDBNavigator) to move through data in the grid, and to insert, delete, and edit the data. Edits that are made in the data grid are not posted to the underlying dataset until the user moves to a different record or closes the application.

TDBGrid Properties

Property Property Columns: Grid columns collection (R)

Describes the display attributes and field bindings of the columns. Use Columns to read or set the field bindings and display attributes of the columns in the data-aware grid. The Columns property is an indexed collection of TColumn objects. Use the properties of the TColumn objects to specify the display attributes or field bindings of individual columns in the grid. The field binding of a column designates a field within the dataset specified by the DataSource property. Columns can be set at design time through the Columns editor, or programmatically at runtime.

Property Property SelectedRows: Bookmark collection (R)

Specifies a set of bookmarks for all the records in the dataset that correspond to rows selected in the grid.

Use this property in combination with the DataSet properties DisableControls, EnableControls and BookMark to implement a multiselectable grid.

General Data-Aware Control Properties

Property Property DataField: String (R/W)

Property Property DataSource: TDataSource (R/W)

Property Property ReadOnly: Boolean (R/W)