473,320 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

check an exception and then continue process

I want to check the Exception --- System.IO.DirectoryNotFoundException
If it occurs then i need to resume the process? Please Guide me Sir...
Thanks....
Dec 15 '08 #1
4 1489
nukefusion
221 Expert 100+
Can you make use of a standard try - catch block?

Format your code with the lines likely to throw an exception in the Try block, catch the exception and do nothing:

Expand|Select|Wrap|Line Numbers
  1. Try
  2.     ' Do your work here
  3. Catch ex As System.IO.DirectoryNotFoundException
  4.     ' Do nothing - resume process
  5. End Try
  6.  
  7.  
Bear in mind that silently eating exceptions isn't considered to be good programming practice although there are some situations where it makes sense.
Dec 15 '08 #2
Frinavale
9,735 Expert Mod 8TB
@nukefusion
Keep Nukefusion's warning in mind. Gobbling up exceptions makes it difficult to debug your code later....it'll appear like your code is running fine but in actuality it's not functioning properly and you wont be able to tell what's happening.
Dec 15 '08 #3
You would have to figure out how you want to handle the exception(s) then after you handle them, call the same sub/function again with the corrected info(parameters would probably be best).

Good Luck!

D
Dec 24 '08 #4
MrMancunian
569 Expert 512MB
Of course, if you only catch a DirectoryNotFoundException, you can just make a messagebox telling the user the directory wasn't found and then continue the process.

I agree with Nukefusion and Frinny that you shouldn't ignore exceptions that are thrown at you, but in this particular case, I think it wouldn't hurt you.

Steven
Dec 29 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: MackS | last post by:
Hi I'm new to Python and would like to know if the following is possible. Say I have one lower-level object A and one user-interface object B. Suppose B.CallingMethod() calls A.CalledMethod(),...
4
by: Richard Lewis | last post by:
Hi there, Is it possible to have an 'except' case which passes control back to the point after the exception occurred? e.g. # a function to open the file # raises FileLockedException is...
11
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
1
by: SHC | last post by:
Hi all, I did the "Build" on the attached code in my VC++ .NET 2003 - Windows XP Pro PC. On the c:\ screen, I got the following: Microsoft Development Environment An unhandled exception of type...
2
by: tom | last post by:
Hi, I am developing a WinForm application and I am looking for a guide on where to place Exception Handling. My application is designed into three tiers UI, Business Objects, and Data Access...
44
by: craig | last post by:
I am wondering if there are some best practices for determining a strategy for using try/catch blocks within an application. My current thoughts are: 1. The code the initiates any high-level...
13
by: tolisss | last post by:
Hi i have setup a global exception handler b4 Application.Run like Application.ThreadException += new ThreadExceptionEventHandler(GlobalExceptionProcessing.AppThreadException ); then after...
9
by: Claudio Di Flumeri | last post by:
Hello all, I've added a global exception handler to my application in this way: Sub Main() AddHandler Application.ThreadException, AddressOf ThreadException AddHandler...
4
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.