Preventing deleting record in a DBGrid

Put code snippet bellow on the OnKeyDown event of the DBGrid.

procedure TForm1.DBGrid1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (ssctrl in shift) and (key=vk_delete) then key:=0;
end;

This entry was posted in Database. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please copy the string AfMwYe to the field below: