Custom Exceptions in VB.NET
Visual Basic .NET offers structured exception handling that provides a powerful, more readable alternative to "On Error Goto" error handling, which is available in previous versions of Microsoft Visual Basic.
In VB.Net we can handle exceptions with great ease and we can also create our own customized exceptions which can later be used for our applications specific needs. Exceptions are objects that encapsulate an irregular circumstance, such as when an application is out of memory, a file that cannot be opened, or an attempted illegal cast.
You can also throw an exception from within your own code using the keyword Throw.
Try your code block Catch ex As Exception exception handling block Finally final cleanup block End Try
The following VB.NET program shows, how to create a custom exception class and how it is using in the program.