简体   繁体   English

vb.net自定义错误处理模块

[英]vb.net custom error handling module

I have written a scanning program in visual basic using wia to scan documents and put them in a specific folder. 我使用wia编写了一个visual basic扫描程序来扫描文档并将它们放在特定的文件夹中。 I would like to add some custom error handling to the project that puts a message box on the screen telling the user the problem and what to do to rectify it(Like no paper in adf or scanner is switched off etc), I would like to put the error handling into a seperate module and have a try/catch block call my module and then return to the program to try again. 我想在项目中添加一些自定义错误处理,在屏幕上放置一个消息框告诉用户问题以及如何纠正它(就像adf或扫描仪中的纸张没有关闭等),我想将错误处理放入一个单独的模块,并使用try / catch块调用我的模块,然后返回程序再试一次。

I have found the following web page 我找到了以下网页

http://graphicsmagician.com/vbcourse/11design/errors.htm ( Example 3) http://graphicsmagician.com/vbcourse/11design/errors.htm (例3)

that explains how to call it but I am not sure how I would add it to my program when I publish it. 这解释了如何调用它但我不确定在发布它时如何将它添加到我的程序中。

I have another project to write that will also use this module so I would like to have it seperate so I can use it in this project aswell. 我有另一个要编写的项目,也将使用这个模块,所以我想让它分开,所以我可以在这个项目中使用它。

Any help would be much appreciated 任何帮助将非常感激

Thanks Gareth 谢谢Gareth

I am not entirely sure about all your project circumstances, but given tha fact you tagged your question as a vb.net question, maybe the following article might be of some help to you: 我不完全确定您的所有项目情况,但鉴于您将问题标记为vb.net问题,可能以下文章可能对您有所帮助:

It's a little bit old, but still might prove usefull: http://msdn.microsoft.com/en-us/library/ms973807.aspx 它有点旧,但仍然可能有用: http//msdn.microsoft.com/en-us/library/ms973807.aspx

So the goal would be to create your Component as a dll Project and then Add this to the project references of any project that is supposed to utilize the functionality of said dll component. 因此,目标是将组件创建为dll项目,然后将其添加到应该利用所述dll组件功能的任何项目的项目引用中。 Once that is done you just need to make sure the dll ships with the Program later. 完成后,您只需要确保dll随后附带本程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM