信息捕捉华给你一个过程:
procedure TFrom1.myExceptHandle(Sender: TObject; E: Exception);
begin
if Pos('valid date',E.Message) > 0 then
Application.messagebox('输入了错误的日期!',pchar(application.title),mb_iconstop+mb_ok)
else if Pos('Value out of bounds',E.Message) > 0 then
Application.messagebox('数据超出范围!',pchar(application.title),mb_iconstop+mb_ok)
else if Pos('a valid floating point',E.Message) > 0 then
Application.messagebox('非法的数值!',pchar(application.title),mb_iconstop+mb_ok)
else if pos('primary',e.Message) > 0 then
Application.messagebox('关键字冲突!',pchar(application.title),mb_iconstop+mb_ok)
else
application.showexception(e);
end;
在formonshow事件中加入
application.OnException :=myexcepthandle;