我想在调用函数返回错误时控制错误消息 [英] i want to control the error message when calling function return an error

查看:90
本文介绍了我想在调用函数返回错误时控制错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在调用函数时发生错误时,我想自定义自己的错误框和消息。

i want to customize my own error box and message when an error occur in calling a function .

在此处输入图片描述

我尝试使用try catch异常,但不执行任何操作

i try to use try catch an exception but not doing anything

    Try
            L = objGeoFlowDLL.GFCalc_Main(nInputs, nOutputs, sngInputs, sngOutputs)

        Catch ex As Exception
            MessageBox.Show(ex.Message)
            '  Me.Close()
        Finally

        End Try


推荐答案

Try
  L = objGeoFlowDLL.GFCalc_Main(nInputs, nOutputs, sngInputs, sngOutputs)
Catch ex As DivideByZeroException
  MessageBox.Show("Custom message to be shown when something is divided by zero.")
Catch ex2 As Exception
  MessageBox.Show("Custom message to be shown when any other error occurs.")
End Try

这篇关于我想在调用函数返回错误时控制错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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