我想在TDBNavigator的BeforeAction中写一段代码,实现在删除数据之前先提示,如果选择了不删可以不执行删除操作。不知道怎么取消当前的删除操作。

解决方案 »

  1.   

    to: hahafan(注意!此人前途迷茫) 
    谢谢!
      

  2.   

    TDBNavigator在删除数据之前默认时有提示的。你也可以这样写:
    procedure TForm1.DBNavigator1BeforeAction(Sender: TObject;
      Button: TNavigateBtn);
    begin
      if Button = nbDelete then
      begin
        if Application.MessageBox('Are you sure to delete this record?','Information',MB_YESNO+MB_ICONQUESTION)=IDNO then exit;
      end;
    end;