Abort in OnBeforeDelete?

Hi,

I have a TClientDataSet and want to display my own confirmation dialog when a user wants to delete a record. So I decided to use TDataSet.OnBeforeDelete to accomplish this.
My problem is now, if the user selects "no", how do I prevent the DataSet from deleting the record?
I haven't found a method for this purpose yet, although I'm quite sure there has to be one.
I guess it's very easy....

thx for your help,
Wyverex
WyverexAsked:
Who is Participating?
 
bpanaConnect With a Mentor Commented:
i know it doesn't ...

just use as:

if .... then
  Abort;
0
 
bpanaCommented:
Abort;
0
 
WyverexAuthor Commented:
TDataSet doesn't know a method called Abort though...
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
bpanaCommented:
Abort raises a silent exception, so it will exit the current procedure without making the post.
0
 
WyverexAuthor Commented:
Ah. Didn't know that there was something like this in Delphi.
Thx alot!
0
 
bpanaCommented:
btw, this is in the Delphi help.
check the Delphi Help for BeforeDelete event.
0
 
bpanaCommented:
you welcome :)
0
 
WyverexAuthor Commented:
>> btw, this is in the Delphi help.
>> check the Delphi Help for BeforeDelete event.

Yes, I've seen that before. But I always thought Abort is a member of TDataSet. And because I couldn't find it in TDataSet I later forgot to look elsewhere ;-)
0
 
kretzschmarCommented:
:-)) funny,
the solution is in the title
0
 
bpanaCommented:
yes :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.