Throwing a Custom Exception in

By: Steven Holzner  

You can customize the exceptions you throw by creating a new exception object based on the ApplicationException object. Here's an example where I'm creating a new ApplicationException object with the text "This is a new exception", and then throwing and catching that exception:

Module Module1
    Sub Main()
            Throw New ApplicationException("This is a new exception")
        Catch e As Exception
        End Try
    End Sub
End Module

Here's what you see when you run this console application:

This is a new exception

Archived Comments

1. custom exception

your code block
Catch ex As Exception

View Tutorial          By: richard at 2012-05-31 08:41:26

Most Viewed Articles (in )

Latest Articles (in

Comment on this tutorial