Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
类库项目中的VB.NET异常处理_Vb.net_Winforms_Exception_Class Library_Autocad - Fatal编程技术网

类库项目中的VB.NET异常处理

类库项目中的VB.NET异常处理,vb.net,winforms,exception,class-library,autocad,Vb.net,Winforms,Exception,Class Library,Autocad,我正在用vb.net做类库项目,以便与AutoCAD一起工作 问题是,消息框在catch块中不起作用,但在代码中的任何地方都可以正常工作。 我尝试了以下几行,在catch的“尝试和默认”对话框中看到了消息框 Try Windows.Forms.MessageBox.Show("Testing Started") Dim x, y, z As Integer x = y / z Catch ex As Exception Windows.Forms.MessageBox.Show(ex.M

我正在用vb.net做类库项目,以便与AutoCAD一起工作 问题是,消息框在catch块中不起作用,但在代码中的任何地方都可以正常工作。 我尝试了以下几行,在catch的“尝试和默认”对话框中看到了消息框

Try
 Windows.Forms.MessageBox.Show("Testing Started")
 Dim x, y, z As Integer
 x = y / z
Catch ex As Exception
 Windows.Forms.MessageBox.Show(ex.Message)
End Try

好啊我得到了它。。我改为:Catch ex As System.exception您会发现AutoCAD名称空间和其他库经常存在歧义。我猜您在右上方导入了Autodesk.AutoCAD.Runtime?AutoCAD允许您访问警报对话框。Application.Alert()我相信。它可能是Document.Alert()。文档是您的文档对象。因此,如果您只是为了警报而导入表单名称空间,那就没有必要了。@Locke您的猜测是对的,我导入了Autodesk.AutoCAD。Runtime@TraeMoore应用程序比那更复杂。我正在基于Excel数据生成AutoCAD图形。我有很多异常,所以,我为错误创建了数据库,并为每个人创建了错误代码。我不再使用Windows.Forms.MessageBox。我为错误处理创建了自己的表单。无论如何,谢谢你的关心。