出错时转到 ErrHand(C#)
在 C# 中,如果出现错误,如何将其发送到错误处理行,如下所示。我知道如何在 Visual Basic 中执行此操作,但在 C# 中需要一些帮助。感谢您的帮助
Sub Main()
On Error GoTo ErrHand
....Code Here
End Sub
ErrHand:
MsgBox "Message Here"
End Sub
How in C# if I have error can I send it to an error handling line like below. I know how to do it in visual basic, but need a little assistance in C#. Thanks for the help
Sub Main()
On Error GoTo ErrHand
....Code Here
End Sub
ErrHand:
MsgBox "Message Here"
End Sub
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
On Error GoTo 模式在 .NET 中升级为:
以下链接错误处理转换应该为您提供一些信息。
The On Error GoTo pattern is upgraded in .NET to:
The following link Error Handling Transformation should give you some info.
您缺少大量 C# 基本信息,是时候进行一些培训了吗?
You're missing a lot of C# basic information, time for a little training?
我可以完成(逻辑上)但它不是purdy
I can be done (logically) but it ain't purdy