Editing in the Grid

From RAD Studio
Jump to: navigation, search

Go Up to Viewing and Editing Data with TDBGrid

At runtime, you can use a grid to modify existing data and enter new records, if the following default conditions are met:

  • The CanModify property of the Dataset is True.
  • The ReadOnly property of grid is False.

When a user edits a record in the grid, changes to each field are posted to an internal record buffer, but are not posted until the user moves to a different record in the grid. Even if focus is changed to another control on a form, the grid does not post changes until another the cursor for the dataset is moved to another record. When a record is posted, the dataset checks all associated data-aware components for a change in status. If there is a problem updating any fields that contain modified data, the grid raises an exception, and does not modify the record.

Note: If your application caches updates, posting record changes only adds them to an internal cache. They are not posted back to the underlying database table until your application applies the updates.

You can cancel all edits for a record by pressing Esc in any field before moving to another record.

See Also