How can I make the program continue its execution even if it crashes(Throws an exception).My current program works just fine if I manually press continue after the execution is thrown,so I want to make it continue the execution each time an exception is thrown.
Asked
Active
Viewed 1,933 times
-4
-
1I wish my software was like that... throwing exceptions and still work... – rene Aug 08 '15 at 15:53
-
hahaa :D well,guess I'm just lucky.. – Cata Aug 08 '15 at 15:54
-
What kind of program is it? Console app, winform, wpf, service, asp.net? – rene Aug 08 '15 at 15:54
-
1Handle the exception... – Preston Guillot Aug 08 '15 at 15:54
-
some extra background [here](http://stackoverflow.com/questions/11658708/ways-to-handle-exception), [here](http://stackoverflow.com/a/2934716/578411) and [here](http://ericlippert.com/category/exception-handling/) – rene Aug 08 '15 at 16:08
-
1I don't mean to be rude, but... Really? – Mihai Caracostea Aug 08 '15 at 17:17
1 Answers
3
Use the try-catch statement.
try
{
// Your code.
}
catch (Exception e)
{
// Handle the exception as you want or need.
}
More information
https://msdn.microsoft.com/en-us/library/0yd65esw(v=vs.120).aspx

Evan
- 115
- 1
- 11