类未注册HRESULT [英] Class Not Registered HRESULT

查看:104
本文介绍了类未注册HRESULT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以当我尝试打开一个Form时出现这个错误...这很精细,我知道为什么我会收到错误。

So I'm getting this error when I try to open a Form...which is FINE, I know why I'm getting the error.

因为那个COM组件未安装在该计算机上,但是我想要尝试在Try Catch中捕获此错误,这样我就可以显示不同的错误消息。

Because that COM Component isn't installed on that machine, but want I'm trying to do is catch this error in a Try Catch so I can display a different Error Message.

Try Catch是没有在Form_Load中收到此错误,那么我应该使用Try Catch来捕获此错误?

The Try Catch is not picking up this error in Form_Load, so which event should I put the Try Catch to capture this error?

谢谢,

Mark

Thanks,
Mark

推荐答案

https://www.codeproject.com/Articles/43182/Centralised-Exception-Handling-in-C-Windows-Applic

https://www.codeproject.com/Articles/43182/Centralised-Exception-Handling-in-C-Windows-Applic

如果您下载源代码,它也有一个VB.NET示例 您可以在项目中实现,并且您不需要在代码中的任何位置使用try / catch,并让全局或集中式异常处理程序捕获异常。

If you download the source code, it has a VB.NET example too  that you can implement in your project, and you don't need a try/catch anywhere in the code and let the global or centralized exception handler catch the exception.


这篇关于类未注册HRESULT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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