i want to control the error message when calling f

2019-03-03 11:21发布

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

enter image description here

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

1条回答
可以哭但决不认输i
2楼-- · 2019-03-03 11:46
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
查看更多
登录 后发表回答