Groups | Blog | Home
all groups > dotnet windows forms > april 2004 >

dotnet windows forms : Close main form on error...


Andrew Parks
4/16/2004 4:36:04 PM
I have a problem: I created a custom license provider for a custom control. I check the validity of the license and if the check fails I display a form with the information (license expired, buy now... etc, the whole thing). Then, if the user presses Close I would like to close the currently running application. But, even if I call Application.Exit() from within the error form, nothing happens. So, right now I am forced to let the LicenseException to be thrown. But that is not good, because after my form is shown then the regular exception message box is shown. Sometimes a request for a debugger appears. I want to avoid that, how can I close the currently running application no matter what? Should I work on the thread? Any suggestion?

Thank you,
Alok
4/19/2004 3:01:14 PM
Hi Andrew,
Checking for the validity occurs at deisgn - time also.
i am not sure whether Application.exit() would work at design - time.
You could probably check if mode = runtime and then check for the validity.

Thanks and regards,
Alok

[quoted text, click to view]
control. I check the validity of the license and if the check fails I
display a form with the information (license expired, buy now... etc, the
whole thing). Then, if the user presses Close I would like to close the
currently running application. But, even if I call Application.Exit() from
within the error form, nothing happens. So, right now I am forced to let the
LicenseException to be thrown. But that is not good, because after my form
is shown then the regular exception message box is shown. Sometimes a
request for a debugger appears. I want to avoid that, how can I close the
currently running application no matter what? Should I work on the thread?
Any suggestion?
[quoted text, click to view]

AddThis Social Bookmark Button