Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Deleting Records

For you to be able to delete records at runtime, the View’s OptionsData.Deleting property must be set to True and then pressing the Del or Ctrl+Del keys will delete the selected records.

If the OptionsSelection.MultiSelect property is set to True, several records can be selected simultaneously. Otherwise, only one record can be selected at a time. Refer to the Selecting Records section for details.

By activating the OptionsData.DeletingConfirmation attribute, it is possible to display a confirmation dialog box before records are deleted.

To delete records programmatically, use the methods provided by a data controller: TcxCustomDataController.DeleteSelection and TcxCustomDataController.DeleteFocused. These methods delete the selected and focused records and do not require any parameters. The following code invokes the DeleteSelection method to delete the selected records from the tvCustomers View:

try
    tvCustomers.DataController.DeleteSelection;
  except
    on E: Exception do
      ShowMessage('Cannot delete selected records due to the exception: ' + E.Message);
  end;

An exception may occur if records cannot be deleted. This can for instance, be caused by the deletion violating the integrity rules.

See Also