![]() ' Code that reacts to a NullReferenceExceptionĬonsole.WriteLine("NullReferenceException: " & ex.Message)Ĭonsole.WriteLine("Stack Trace: " & ex.StackTrace) 'A finally block is always executed, regardless of if an Exception occurred.ĭim prop = obj.Name 'This line will throw a NullReferenceExceptionĬonsole.WriteLine("Test.") ' This line will NOT be executed 'You can show the error in a MessageBox with the below line. 'Details of the exception, in this case, are in the "ex" variable. 'This catch block handles all Exception types. 'For example, this Catch block handles an IOException. 'is examined in textual order to determine which handles the exception. 'If an exception occurs when processing the Try block, each Catch statement 'without executing the lines after the one which caused the exception. 'If any exceptions are thrown, the code in the Catch Block will be executed, ![]() 'Your program will try to run the code in this block.
0 Comments
Leave a Reply. |