Have a piece of logic that looks like that:
Dim fInfo As New FileInfo(LocationDir & Filename)
If Not fInfo.Exists Then
Console.WriteLine("File does not exist." & Filename)
Throw New Exception("File does not exist." & Filename)
End If
That supposed to throw the exception, stop the execution of the whole module, and get out. Understand it is not a peaceful ending. When I am getting is that there is unhandled error. and besides the console , another box pops up: that the application failed, and needs to be closed or debugged. I guess I need to handle the graceful termination of the module. Any suggestions?
Roland asked a great question where do I catch that user exception. And I am being totally honest that after searching and reading a lot, still cannot understand where and how I can catch it. It could be very trivial for experienced users, but would love to have a piece of code to use as a base.