I am using VS2005 C#, and I have an application which has a few functions like list, edit database, import and export of data.
However, I have no clue of catching and handling errors. Below is a sample screenshot of an error met when the column of a file imported does not match with the database, and stops the application from running and points straight to my backend code:

Preiovusly I am using Netbeans and it clearer to me in Netbeans because they always specify each error with an error code, so I was able to assign a webpage for each individual error code.
May I know how can I identify these errors and how can I handle them? Is it possible to assign a webpage redirection when an error is met?
Thank you
There are three ways to handle exceptions in ASP.NET:
Examples:
1.Exception Handling at page level.
2.Exception Handling at website level.
3.Exception Handling at website level by using web.config.
The customErrors element of the web.config file is the last line of defense against an unhandled error. If you have other error handlers in place, like the Application_Error of Page_Error subs, these will get called first. Provided they don’t do a Response.Redirect or a Server.ClearError, you should be brought to the page(s) defined in the web.config. In the web.config file, you can handle specific error codes (500, 404, etc), or you can use one page to handle all errors. This is a major difference between this method and the others (although you can emulate this by doing various Response.Redirects using the other methods). Open up your web.config file. The customErrors section uses this format:
Here is some important information about the “mode” attribute:
“On” specifies that custom errors are enabled. If no defaultRedirect is specified, users see a generic error.
“Off” specifies that custom errors are disabled. This allows display of detailed errors.
“RemoteOnly” specifies that custom errors are shown only to remote clients, and ASP.NET errors are shown to the local host. This is the default.
By default, the section looks like this when you create a Web application.