Mega Code Archive

 
Categories / VB.Net / Language Basics
 

Try and catch Exception

Imports System Imports System.Diagnostics Public Class MainClass     Shared Sub Main()         Try             Dim i As Integer = CInt("bad value")         Catch ex As InvalidCastException             Dim txt As String = "InvalidCastException"             MsgBox(txt)         Catch ex As Exception             Dim txt As String = "Exception"             MsgBox(txt)         End Try     End Sub End Class