Catch Exception Demo : Catch Exception « Language Basics « VB.Net






Catch Exception Demo

Catch Exception Demo
Imports System

Public Class MainClass

  Shared Sub Main()
    Dim x As Int32 = 100
    Dim y As Int32 = 0
    Dim k As Int32

    Try
      k = x / y
    Catch e As Exception
      Console.WriteLine(e.Message)
    End Try

  End Sub
  
End Class


           
       








Related examples in the same category

1.Catch All Unhandled ExceptionsCatch All Unhandled Exceptions
2.Try and catch Exception: InvalidCastException