Hi,
If i run the following program I get these messages: "show this", "caught",
"error", so the for loop in A is never completed
What I want is "show this", "caught", "error", "show this", "caught",
"error". How can I do that?
Here's my sample code:
private void StartHere()
{
try
{
new A();
}
catch
{
MessageBox.Show("error");
}
}
class A
{
public A()
{
for (int i = 0; i < 2; i++)
{
try
{
MessageBox.Show("show this");
new B();
MessageBox.Show("don't show this");
}
catch
{
MessageBox.Show("caught");
throw;
}
}
}
}
class B
{
public B()
{
throw new ApplicationException();
}
}
(B downloads a website, so there might occur an exception. A starts several
downloads (new B), if one fails the other should nevertheless be started
(the for loop must be completed) and the failed one be removed ("caught").
the first method reports the error to the user ("error"))