Object Reference > True DBGrid Events > BeforeDelete Event |
BeforeDelete Event
The BeforeDelete event occurs before a selected record is deleted from the grid.
TDBGrid_BeforeDelete (Cancel As Integer)
Arguments
Cancel is an integer that may be set to True to prevent the deletion from occurring.
When the user selects a record selector in the grid and presses Del or Ctrl+X, the BeforeDelete event is triggered to give your application a chance to override the user's action.
If your event procedure sets the Cancel argument to True, the row is not deleted. Otherwise, the grid deletes the row and triggers the AfterDelete event.
The bookmark of the row selected for deletion is available in the collection provided by the SelBookmarks property.
Note
If more than one row is selected, the error message Cannot delete multiple rows is displayed, and the BeforeDelete event will not be fired.