陷阱错误或“继续下一步” [英] Trap error or 'Resume Next'

查看:114
本文介绍了陷阱错误或“继续下一步”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我意识到这是一个较旧的编程环境,但是我必须清理一些 VB6 代码,我发现它大部分使用:

 关于错误恢复下一步

关于使用关于错误恢复下一步的一般共识是什么?



当然,如果出现错误,您希望应用程序停止正在进行的操作,回滚任何数据更改,并通知用户错误,而不是只需要恢复。



使用是一个好主意在错误简历下一步

解决方案

我发现在错误不会保证用户被中断的问题的功能中有用。调整大小事件的一个很好的例子。如果您发生错误或在resize事件中出现问题,那么您可能不希望用户看到这一点,因为它可能不会影响功能。



我一般会说,谨慎使用。


I realise this is an older programming environment, but I have to clean up some VB6 code and I am finding that most of it uses:

On Error Resume Next

What is the general consensus about the use of On Error Resume Next?

Surely, if there is an error, you would want the app to stop what it was doing, rollback any data changes, and inform the user of the error, rather than just resuming.

When is it a good idea to use On Error Resume Next?

解决方案

I have found it useful in functions where an error would not warrant the user being interrupted with the issue. A good example is in the resize event. If you make a mistake or there's a problem in the resize event then you probably don't want the user to see this, as it probably wouldn't affect functionality.

I would say in general, use it sparingly.

这篇关于陷阱错误或“继续下一步”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆