sharol
asked on
Delete Records from DBGrid
how do I delete a record from a dbgrid which is connected to a dataset?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
But please, prevent the users errors, adding this code in the beforeDelete event of your Ttable:
if Application.MessageBox('¿A re you sure....?','Atención',mb_O kCancel + mb_IconQuestion)= idcancel then
abort;
I think that dgConfirmDelete (Options) is set to False, to avoid the not customize message.
Best Regards.
Marcos.
if Application.MessageBox('¿A
abort;
I think that dgConfirmDelete (Options) is set to False, to avoid the not customize message.
Best Regards.
Marcos.
sharol:
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
Hi!
No comment has been added lately and this question is therefore classified abandoned.
If asker wishes to close the question, then refer to
https://www.experts-exchange.com/help/closing.jsp
Otherwise, I will leave a recommendation in the Cleanup topic area that this question is:
Answered by: kretzschmar
Please leave any comments here within the next seven days. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
...Snehanshu
EE Cleanup Volunteer
No comment has been added lately and this question is therefore classified abandoned.
If asker wishes to close the question, then refer to
https://www.experts-exchange.com/help/closing.jsp
Otherwise, I will leave a recommendation in the Cleanup topic area that this question is:
Answered by: kretzschmar
Please leave any comments here within the next seven days. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
...Snehanshu
EE Cleanup Volunteer
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, DBTables, Grids, DBGrids;
type
TForm1 = class(TForm)
DataSource1: TDataSource;
DBGrid1: TDBGrid;
Table1: TTable;
procedure DBGrid1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.DBGrid1KeyDown(Send
Shift: TShiftState);
begin
If Key = VK_Delete then
begin
if MessageDlg('Are you sure you want to delete this record ?',
mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
Table1.Delete;
MessageDlg('Record has been deleted.', mtInformation,
[mbOk], 0);
end;
end;
end;
end.