如何在VB.NET中引发异常?

前端之家收集整理的这篇文章主要介绍了如何在VB.NET中引发异常?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如何在VB.NET中引发异常?
你会抛出一个新的异常。

看看Throw Statement (Visual Basic)

The Throw statement throws an exception that you can handle with
structured exception-handling code (Try…Catch…Finally) or
unstructured exception-handling code (On Error GoTo). You can use the
Throw statement to trap errors within your code because Visual Basic
moves up the call stack until it finds the appropriate
exception-handling code.

编辑

按请求和从链接

Throw New System.Exception("An exception has occurred.")

猜你在找的VB相关文章