Advertisement
smashapps

Try catch with Exception message

May 17th, 2011
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class Form1
  2.  
  3.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  4.         Try
  5.             Image.FromFile(Application.StartupPath & "/image.png")
  6.         Catch ex As Exception
  7.             MsgBox("Cannot find the image from this path:" & vbNewLine & ex.Message)
  8.         End Try
  9.     End Sub
  10. End Class
  11.  
  12. 'The Ex.message gives you more details on the error, in this instance the path it could not find.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement