VB.NET On Error GoTo
On Error GoTo statements is an example of Vb.Net's Unstructured Exception Handling . VB.NET has two types of Exception handling . Structured Error Handling and Unstructured Error handling . VB.NET using Try..Catch statement for Structured Error handling and On Error GoTo statement is using for Unstructured Error handling.
Error GoTo redirect the flow of the program in a given location.
On Error Resume Next - whenever an error occurred in runtime , skip the statement and continue execution on following statements.
Take a look at the following program
VB.NET Source Code
when u execute this program you will get error message like Arithmetic operation resulted in an overflow .
See the program we put an On Error GoTo statement.
When you execute the program you will get the message box "Control Here" . Because the On Error statement redirect the exception to the Label statement.