public class Test
public Shared Sub Main
Try
Dim i As Integer = CInt("bad value")
Catch ex As InvalidCastException
Dim txt As String = "InvalidCastException"
Console.WriteLine(txt)
Catch ex As Exception
Dim txt As String = "Exception"
Console.WriteLine(txt)
End Try
End Sub
End class
InvalidCastException