procedure TloginForm1.Button1Click(Sender: TObject);
var
flag:boolean;
begin
flag:= true;
try
strtodate(edit1.text);
except
on econverterror do
flag:=false;
end;
if flag=false then
showmessage(Chinese);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnException := AppException;
......
end;
procedure TForm1.AppException(Sender: TObject; E: Exception);
begin
if (Sender is TDbEdit) then
begin
if (Sender as TDbEdit).Name = 'DBEditName1' then
Application.MessageBox('DBEditName1输入格式错误!','错 误',MB_ICONERROR+MB_OK);
if (Sender as TDbEdit).Name = 'DBEditName2' then
Application.MessageBox('DBEditName2输入格式错误!','错 误',MB_ICONERROR+MB_OK);
......
end
else
Application.MessageBox(PChar('发生错误: '+E.Message),'错误',MB_ICONERROR+MB_OK);