Using Finally in VB.net
The code in the Finally block, if there is one, is always executed in a Try…Catch…Finally statement, even if there was no exception, and even if you execute an Exit Try stateme
Read tutorialTHE TUTORIAL LIBRARY
The code in the Finally block, if there is one, is always executed in a Try…Catch…Finally statement, even if there was no exception, and even if you execute an Exit Try stateme
Read tutorialYou also can use multiple Catch statements when you filter exceptions. Here's an example that specifically handles overflow, invalid argument, and argument out of range exceptions:
Read tutorialWhen you're handling exceptions, you usually want to handle different types of exceptions differently, according to the nature of the exception that occurred. This process is calle
Read tutorialThere are cases in programs where you might want to create an exception because, although no Visual Basic trappable exception has occurred, some situation may have occurred that's
Read tutorialFor more information on exceptions, you can use the Err object's Number and Description properties, like this:
Read tutorialTo turn off unstructured exception handling, you can use the On Error GoTo 0 or On Error GoTo -1 statements. Here's an example:
Read tutorialOne of the most useful aspects of unstructured exception handling is the Resume statement, which lets you resume program execution even after an exception has occurred. You can use
Read tutorialThe scope of a variable or constant is the set of all code that can refer to it without qualifying its name. A variable's scope is determined by where the variable is declared. It'
Read tutorialVisual Basic objects can have methods, fields, and properties. If you've worked with Visual Basic before, you're familiar with properties, which you use to set configuration data f
Read tutorialSometimes, it's useful to be able to pass the location of a procedure to other procedures. That location is the address of the procedure in memory, and it's used in VB .NET to crea
Read tutorialYou've written a function named Counter to keep track of the number of times the user clicks a particular button. Each time through a loop, you call the Counter function to increme
Read tutorialYou also can make arguments optional in VB .NET procedures if you use the Optional keyword when declaring those arguments. Note that if you make one argument optional, all the foll
Read tutorialOne example today. A better developer tomorrow.