Use a try statement with multiple catch clauses like so
Try
'insert exception prone code here
Throw New OutOfMemoryException
Throw New InvalidCastException
Catch ex As OutOfMemoryException
Console.WriteLine("out of memory")
Catch ex2 As InvalidCastException
Console.WriteLine("invalid cast")
End Try
Then if an out of memory exception is thrown the 1st catch clause will be executed if an invalid cast exception is thrown the 2nd catch clause will be executed.
You can change the exception type to whatever suits your needs as this is only an example
Hope this helps