Question regarding exception....

W

Wallace

Hai All,

I have one doubt, here is the code sample....

try
{
for loop
{
// doing some operations.....
}
}

catch(Exception e)
{
string str = e.Message;
}

If an exception occurs within the for loop and it will come to catch
block.
My question is " after getting the e.Message how can continue the
for loop with next set of values?"

Please help...
Looking forward fir the reply...
Thanx in advance...
 
C

Chris Chilvers

Hai All,

I have one doubt, here is the code sample....

try
{
for loop
{
// doing some operations.....
}
}

catch(Exception e)
{
string str = e.Message;
}

If an exception occurs within the for loop and it will come to catch
block.
My question is " after getting the e.Message how can continue the
for loop with next set of values?"

Please help...
Looking forward fir the reply...
Thanx in advance...

If you want to continue the loop can you not place the try ... catch inside the for loop? Also it's a bad idea normally
to catch all exceptions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top