G
Guest
Apologies if this is the wrong forum for this question.
Could anyone explain why this exception code is not working?
The exception is thrown, but then reported as unhandled. The try catch in
Main seems to be being ignored???
The exception being reported is a generic System.Exception, nothing exotic.
This is only an illustration by the way
public class A
{
Public void Bla()
{
if (something) { throw new Exception(“An Errorâ€); }
}
}
public class B
{
static void Main()
{
// A collection of A's exists
foreach (A item in ACollection)
{
try
{
item.Bla();
}
catch
{
MessageBox.Show(“Caughtâ€);
}
}
}
}
Any help much appreciated.
Could anyone explain why this exception code is not working?
The exception is thrown, but then reported as unhandled. The try catch in
Main seems to be being ignored???
The exception being reported is a generic System.Exception, nothing exotic.
This is only an illustration by the way
public class A
{
Public void Bla()
{
if (something) { throw new Exception(“An Errorâ€); }
}
}
public class B
{
static void Main()
{
// A collection of A's exists
foreach (A item in ACollection)
{
try
{
item.Bla();
}
catch
{
MessageBox.Show(“Caughtâ€);
}
}
}
}
Any help much appreciated.