如何在程序中写报错:
比如说定义一个变量上限100,当超过上限时如何越过DELPHI的报错,跳到自己报错程序中。这样的处理程序如何写?
比如说定义一个变量上限100,当超过上限时如何越过DELPHI的报错,跳到自己报错程序中。这样的处理程序如何写?
解决方案 »
- delphi canvas 绘图点击事件
- TFolderTree 怎么刷新问题,谢谢
- 一个菜鸟问题
- 为什么我的web server application程序没有错误,发布后(本机调试)显示该网页无法显示?
- "五一"一天都没得放,而且没有加班费,极度不爽~~~~~~~~~~散分~~~~~~~~~
- Delphi cxDBTreeList 父节点选择同时也选择它的子节点
- 请问怎么去掉LISTVIEW的滚动条
- delphi licence控件,三访控件谁有呢?
- To:千两狂死郎::Fastreport控件如何安装???
- delphi中如何调用Excel来显示和打印报表?
- *.db能不能远程访问(互联网/局域网)?如何实现?
- 在哪里可以调试存储过程
i:=111;
if i>100 then raise exception.create('超出了100');
except
on e:exception do
messageDlg( e.Message,mtinformation,[mbOk],0);
end;
//handle all exception and log it
//2003.02.26
var
FileName:String;
LogFile:TextFile;
begin
FileName:=ChangeFileExt(Application.ExeName,'.log');
AssignFile(LogFile,FileName);
if FileExists(FileName) then
Append(LogFile)
else
Rewrite(LogFile);
WriteLn(LogFile,DateTimeToStr(Now)+':'+#9+E.ClassName+':'+#9+E.MEssage);
CloseFile(LogFile);
Application.ShowException(E);
end;procedure TFormMain.TntFormCreate(Sender: TObject);
begin
Application.OnException:=OnAppException;
...
end;
try
i:=111;
if i>100 or i<1 then raise exception.create('please write a value between 1--100');
except
on e:exception do
messageDlg( e.Message,mtinformation,[mbOk],0);
end;