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.
- 1I wish my software was like that... throwing exceptions and still work...rene– rene2015-08-08 15:53:10 +00:00Commented Aug 8, 2015 at 15:53
- hahaa :D well,guess I'm just lucky..Cata– Cata2015-08-08 15:54:09 +00:00Commented Aug 8, 2015 at 15:54
- What kind of program is it? Console app, winform, wpf, service, asp.net?rene– rene2015-08-08 15:54:26 +00:00Commented Aug 8, 2015 at 15:54
- 1Handle the exception...Preston Guillot– Preston Guillot2015-08-08 15:54:30 +00:00Commented Aug 8, 2015 at 15:54
- 1I don't mean to be rude, but... Really?Mihai Caracostea– Mihai Caracostea2015-08-08 17:17:17 +00:00Commented Aug 8, 2015 at 17:17
| Show 1 more comment
1 Answer
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