Visual Basic .NET/Exception handling

Exception handling
There are two main ways to handle errors in code, in order to avoid to stop the program when they occur.

The older method used in VBA is "unstructured" error handling, still available via the  syntax, because it uses a Goto toward a label. This is still useful in certain circumstances where you wish to  processing after handling the error.

To avoid to define the labels, it's possible to simply ask to ignore all errors, during a certain time, and reactivate them with :

"Structure error handling" is available with the newer  syntax. Various error conditions are implemented via inheritors of the base  class.

HINT: If you wish to re-throw an exception inside a  block, use the   keyword without any arguments (particularly, do not use "Throw ex"). The Throw keyword resets the  property of the exception object if an argument is supplied. Throw, without any arguments inside a  block will re-throw the error without resetting the   property.

Visual Basic .NET/Gestion d'exception