In this tutorial, we cover how to deal with unhandled exceptions (errors in vb.net application) using try catch block. If your application has ever stopped working because of an unhandled exception, you will understand how frustrating it is. Using try catch block, you can set a failsafe for errors and then choose a way to deal with them, and you can make your own errors and display in message box or text box.
Copy and paste below Code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Catch ex As Exception