How i can catch Edbediterror with message 'invalid input value'?

dear friends,
i am using delphi5 & i had set a date's editmask as !90/90/0000;1;
when user inputs a value & if he suddenly exit without entering full date,
there is a EdbEditErrore with message' invalid input value'.
I want to catch this error and display my own messagebox, How can i do this?

Thanking you,

Rajkiran Bilolikar.

RajkiranAsked:
Who is Participating?
 
LukA_YJKConnect With a Mentor Commented:
There are some events OnEdit/PostError in TDataSet, are not there? Hope it will work...
0
 
Mohammed NasmanConnect With a Mentor Software DeveloperCommented:
Hello

  Catch that error in Application.OnException, in this way, you can catch it even if you don't use database with your mask

Here's an example

TForm1 = class(TForm)
  .....
  private
    procedure MyException(Sender: TObject; E: Exception);
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
  Application.OnException := MyException;
end;

procedure TForm1.MyException(Sender: TObject; E: Exception);
const
  mskDateError = 'Invalid input value.  Use escape key to abandon changes';
begin
  if E.Message = mskDateError then
    MessageDlg('You should enter valid date',mtError,[mbYes],0);

end;

Best regards
Mohammed Nasman
0
 
CleanupPingCommented:
Rajkiran:
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.
0
 
Mohammed NasmanSoftware DeveloperCommented:
spilt points between LukA_YJK and me
0
 
kacorretiredCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:
       to split points between LukA_YJK and mnasman
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Some days and here is the Christmas Time. I wish good luck and good health for you all and for your loved ones

kacor
EE Cleanup Volunteer
0
All Courses

From novice to tech pro — start learning today.