How to stop a process without reporting an error?  
Author Message
Stanley Chou.





PostPosted: Visual C# General, How to stop a process without reporting an error? Top

Hi,

Sometimes I need to stop the current process without reporting any messages or errors. For instance, I may need to show a message and end an execution (the code in current class and descendant) when a validation failed. I can't just throw an exception because I have my own message dialog style. Now, what I do is design a AbortException class and handle (do nothing, actually) this exception in Application.ThreadException event. So whenever I need to stop a process I throw this AbortException, and it works like a silent exception just like Abort method in Delphi. Does anyone have better ideas

Thanks.

Stanley



Visual C#14