gpt4 book ai didi

vb.net - 我想在调用函数返回错误时控制错误消息

转载 作者:行者123 更新时间:2023-12-03 08:46:18 25 4
gpt4 key购买 nike

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

enter image description here

我尝试使用try捕获异常,但是什么也没做

    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

关于vb.net - 我想在调用函数返回错误时控制错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53153975/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com