退出一个过程时的问题,在线等待!!! 分不够可以再加 (20分)

3

3368aa

Unregistered / Unconfirmed
GUEST, unregistred user!
请问,我在一个过程中
procedure pro;
begin
if 有错误 then exit;
end;

我在另一个过程中调用,要怎样才能退出调用它的过程?
 
根据function返回值
 
那么在过程中怎样实现呢
 
function pro;
begin
if 有错误 then
begin
result:=-1
exit;
end;
end;

funtion aaaa;
begin
if(pro==-1) then exit;
end;
 
过程抛出一个错误不救得了?
procedure a;
begin
....
if 错误条件 then raise Exception.Create('error');
...
end;

procedure b;
begin
try
a;
except
exit;
end;
....
end;
 
一个C风格和++风格看你喜欢用那个了
 
我喜欢有返回值的,可以定义相应的值代表相应的错误。
进行相应的处理。
 
抛出错误可以返回更详细的信息,只是麻烦点
 
又出现新问题
这个过程在一个showmodal的窗体中调用,当这在过程中exit或是abort时,结果窗体也关闭,
怎么办???
 
用函数,不要用过程了。
 
谢谢楼上的各位:
问题已经找到了,我用了一个tbitbtn,并把kind选为ok了,所以出现这种现象

如果我不换控件,怎么屏蔽这种情况呢???
 
多人接受答案了。
 
顶部