Try Catch not executing all lines of code in catch statement C#
I have a try-catch where I try to use an api function for some 3rd party stuff and if it doesn't work, I pop up a message box and set a flag. Problem is, the fla开发者_高级运维g doesn't get set, even though the message box pops up.
I really need to set that SkipThis flag to true since this thing is running on the tick event of a timer and will keep popping up error message boxes if I don't skip it!
try
{
MachStatus.arUploadFromController();
}
catch (DMCException MyException)
{
MessageBox.Show("Error#: " + MyException.DMCErrorCode + " - " + MyException.Message);
SkipThis = true;
}
EDIT: I solved this by putting the SkipThis = true' above the message box line.
精彩评论