On Error Resume Next [英] On Error Resume Next
问题描述
我想知道On Error Resume
Next之间是否存在差异错误处理程序并留下catch在try-catch-end中阻止空白
尝试阻止忽略我当然不赞同的异常,但只需要询问
。
谢谢
Hi,
I want to find out if there''s difference between "On Error Resume
Next" error handler and leaving "catch" block empty in a try-catch-end
try block to ignore exceptions which i don''t approve of course but
just needed to ask.
Thanks
推荐答案
" kimiraikkonen" < ki ************* @ gmail.comschrieb:
"kimiraikkonen" <ki*************@gmail.comschrieb:
我想知道两者之间是否存在差异;错误恢复时
下一步错误处理程序并留下catch在try-catch-end中阻止空白
尝试阻止忽略我当然不赞同的异常,但只需要询问
。
I want to find out if there''s difference between "On Error Resume
Next" error handler and leaving "catch" block empty in a try-catch-end
try block to ignore exceptions which i don''t approve of course but
just needed to ask.
''On Error Resume Next''将在下一个语句后继续执行
引发错误的语句/抛出异常而
''尝试...... Catch''将停止执行并直接跳转到''Catch''块。
\\\\ \\ / $
On Error Resume Next
< Statement 1>
< Statement 2''语句抛出异常。
<声明3>
错误GoTo 0
///
在上面的代码< Statement 3将被执行,但不会在下面的代码示例中执行
:
\\\
尝试
<声明1>
<声明2''声明抛出异常。
<声明3>
Catch
结束尝试
///
与错误恢复相似的行为接下来''你' d必须将
的每个陈述放在一个单独的''Try ... Catch''块中。
-
MS Herfried K. Wagner
MVP< URL:http://dotnet.mvps.org/>
VB< URL:http://dotnet.mvps .org / dotnet / faqs />
''On Error Resume Next'' will continue execution on the next statement after
the statement which raised the error/threw the exception whereas
''Try...Catch'' will stop execution and jump directly into the ''Catch'' block.
\\\
On Error Resume Next
<Statement 1>
<Statement 2 '' Statement throwing an exception.
<Statement 3>
On Error GoTo 0
///
In the code above <Statement 3will be executed, but it won''t be executed
in the code sample below:
\\\
Try
<Statement 1>
<Statement 2 '' Statement throwing an exception.
<Statement 3>
Catch
End Try
///
To archieve similar behavior to ''On Error Resume Next'' you''d have to put
each statement in a separate ''Try...Catch'' block.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
" kimiraikkonen" < ki ************* @ gmail.comwrote in message
news:3a ***************** ***************** @ i3g2000h sf.googlegroups.com ...
"kimiraikkonen" <ki*************@gmail.comwrote in message
news:3a**********************************@i3g2000h sf.googlegroups.com...
我想知道On Error Resume
Next之间是否存在差异错误处理程序并留下catch在try-catch-end中阻止空白
尝试阻止忽略我当然不赞同的异常,但只需要询问
。
谢谢
Hi,
I want to find out if there''s difference between "On Error Resume
Next" error handler and leaving "catch" block empty in a try-catch-end
try block to ignore exceptions which i don''t approve of course but
just needed to ask.
Thanks
On Error Resume Next
声明1
声明2
....
与
相同尝试
对帐单1 < br $> b $ b抓住
结束尝试
试试
声明2
catch
结束尝试
....
Mike。
On Error Resume Next
Statement 1
Statement 2
....
is the same as
Try
statement 1
catch
end try
try
statement 2
catch
end try
....
Mike.
1月21日,12:05 * am,Herfried K. Wagner [MVP]" < hirf-spam-me-
h ... @ gmx.atwrote:
On Jan 21, 12:05*am, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...@gmx.atwrote:
" kimiraikkonen" < kimiraikkone ... @ gmail.comschrieb:
"kimiraikkonen" <kimiraikkone...@gmail.comschrieb:
我想知道On Error Resume
$ b之间是否存在差异$ b下一个错误处理程序并留下catch在try-catch-end中阻止空白
尝试阻止忽略我当然不赞同的异常,但只需要询问
。
I want to find out if there''s difference between "On Error Resume
Next" error handler and leaving "catch" block empty in a try-catch-end
try block to ignore exceptions which i don''t approve of course but
just needed to ask.
''On Error Resume Next''将在下一个语句后继续执行
引发错误/抛出异常的语句而
''尝试...... Catch''将停止执行并直接跳转到''Catch''区块..
\\ \\ /
On Error Resume Next
< Statement 1>
< Statement 2 * *''语句抛出异常。
<声明3>
错误转到0
///
在上面的代码中<声明3将被执行,但它不会在下面的代码示例中执行
:
\\\
尝试
* *<声明1>
* *<声明2 * *''声明抛出异常。
* *<声明3>
Catch
结束尝试
///
为''On Error Resume Next'提供类似的行为你必须把
的每个陈述放在一个单独的''Try ... Catch''块中。
-
* MS * Herfried K. Wagner
MVP *< URL:http://dotnet.mvps.org/>
* VB *< URL :HTTP://dotnet.mvps.org/dotnet/faqs/>
''On Error Resume Next'' will continue execution on the next statement after
the statement which raised the error/threw the exception whereas
''Try...Catch'' will stop execution and jump directly into the ''Catch'' block..
\\\
On Error Resume Next
<Statement 1>
<Statement 2* *'' Statement throwing an exception.
<Statement 3>
On Error GoTo 0
///
In the code above <Statement 3will be executed, but it won''t be executed
in the code sample below:
\\\
Try
* * <Statement 1>
* * <Statement 2* *'' Statement throwing an exception.
* * <Statement 3>
Catch
End Try
///
To archieve similar behavior to ''On Error Resume Next'' you''d have to put
each statement in a separate ''Try...Catch'' block.
--
*M S * Herfried K. Wagner
M V P *<URL:http://dotnet.mvps.org/>
*V B * <URL:http://dotnet.mvps.org/dotnet/faqs/>
感谢您的好解释。一个有趣的方法可能是
try-catch用on next resume next做同样的事情? :-)
尝试
< statement1>
< statement2''statement2发生异常
< statement3>
Catch
< statement3''如果< statement2>中发生异常
>
结束尝试
有点好笑......
Thanks for the nice explanation. Could a funny approach would be for
try-catch to do the same with "on error resume next"? :-)
Try
<statement1>
<statement2'' Exception occurs for statement2
<statement3>
Catch
<statement3'' If a exception is occured in <statement2>
End Try
A bit funny...
这篇关于On Error Resume Next的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!