TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
clive908
NA
7
0
Why is this exception caught in VS but not in exe?!
Nov 23 2005 11:37 AM
I have a program which puts progress info in a listbox as it runs. Based on this, the user may decide to stop at any time. To make this easy, I added a stop button which throws an exception which I catch. The wierd thing is, inside Visual Studio, it works as expected. The loop stops and no exception is displayed because I catch my own exception. Outside of Visual Studio, it raises and displays an exception which either lets me continue or close the program! Why?! Here is a cut-down version of what I am doing: private void StartLoopButton_Click(object sender, System.EventArgs e) { while (true) { try { //Give the applicatio a chance to see the exception Application.DoEvents(); } catch (CancelExportException) { break; } } } private void ThrowExceptionButton_Click(object sender, System.EventArgs e) { throw new CancelExportException(); } ... ///
/// My exception; raised when user wishes to stop the export. ///
public class CancelExportException : ApplicationException {}
Reply
Answers (
0
)
ASP Web App
Automation Word to perform client-side Mailmerge from server