尝试 - 除了不显示异常错误消息

时间:2016-05-18 02:56:49

标签: delphi exception-handling delphi-7

我的代码:

procedure TForm1.Button1Click(Sender: TObject); var   number, zero : Integer; 
begin   // Try to divide an integer by zero - to raise an exception   
    try
        zero   := 0;
        number := 1 div zero;
        ShowMessage('number / zero = '+IntToStr(number));   
    except
        on E : Exception do
            ShowMessage(E.ClassName+' error raised, with message : '+E.Message);
    end; 
end;

显示:

enter image description here

并且不显示我的ShowMessage。

0 个答案:

没有答案