Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Exceptions help
#1
Hello everyone

I have two questions that are bothering me now for a long time but can't find any answers to it. These questions are about Exceptions in VB.NET.

- I know what the Try...Catch block does, it catches any errors, but how far do you have to go? For example you want to open a file but it is
possible that the file doesn't exist then you use the Try...Catch, I know that. Is it also needed for example changing the text of a textbox or editing items in a treeview...

- The second question is about the Finally block. Let's say we've downloaded a file but there occurres an error during the downloading process, the Catch block catches the error... and then I want to remove the downloaded file if it exists. Then there is a possibility that the file doesn't exist so if I write
Code:
My.Computer.DeleteFile(pathFile)
in the Finally block it throws a second exception right? or does VB.NET take care of that automatically?


Thanks, Brecht


Messages In This Thread
Exceptions help - by brco900033 - 08-04-2013, 08:28 AM
Re: Exceptions help - by brco900033 - 08-05-2013, 03:12 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)