Click here to Skip to main content
15,888,286 members
Home / Discussions / C#
   

C#

 
GeneralRe: try/catch fails ? Pin
Christian Graus9-Jun-05 14:31
protectorChristian Graus9-Jun-05 14:31 
GeneralRe: try/catch fails ? Pin
MoustafaS9-Jun-05 14:45
MoustafaS9-Jun-05 14:45 
GeneralRe: try/catch fails ? Pin
Christian Graus9-Jun-05 14:50
protectorChristian Graus9-Jun-05 14:50 
AnswerRe: try/catch fails ? Pin
Luis Alonso Ramos9-Jun-05 15:45
Luis Alonso Ramos9-Jun-05 15:45 
GeneralRe: try/catch fails ? Pin
Christian Graus9-Jun-05 15:47
protectorChristian Graus9-Jun-05 15:47 
GeneralRe: try/catch fails ? Pin
mav.northwind9-Jun-05 20:13
mav.northwind9-Jun-05 20:13 
GeneralRe: try/catch fails ? Pin
Gary Kirkham13-Oct-05 6:54
Gary Kirkham13-Oct-05 6:54 
AnswerRe: try/catch fails ? Pin
Luis Alonso Ramos13-Oct-05 7:10
Luis Alonso Ramos13-Oct-05 7:10 
Gary Kirkham wrote:
Is there a way to programatically shutdown and restart a .Net application? If so, how do you do it?
Well, what you do is start another instance of the application before shutting down the current instance.

When I trap the exception, I display a dialog with all the exception details. When the form is closed, if a checkbox is checked, I start another instance of my own application, and then shut down the application. This is my handler for the Close button on the exception report form:
private void btnClose_Click(object sender, System.EventArgs e)
{
    // Restart the application if desired
    if(chkRestart.Checked)
        System.Diagnostics.Process.Start(Application.ExecutablePath);

    Application.Exit();  // Kill this instance

    DialogResult = DialogResult.OK;  // Just for formality -- not really needed
}
I hope this helps!

-- LuisR



Luis Alonso Ramos
Intelectix - Chihuahua, Mexico

Not much here: My CP Blog!


The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
GeneralRe: try/catch fails ? Pin
Gary Kirkham13-Oct-05 8:07
Gary Kirkham13-Oct-05 8:07 
GeneralRe: try/catch fails ? Pin
Luis Alonso Ramos13-Oct-05 8:13
Luis Alonso Ramos13-Oct-05 8:13 
GeneralRe: try/catch fails ? Pin
Gary Kirkham13-Oct-05 8:17
Gary Kirkham13-Oct-05 8:17 
QuestionHow to gracefully handle program crashing when executed using Process object Pin
xdansmith9-Jun-05 13:36
xdansmith9-Jun-05 13:36 
AnswerRe: How to gracefully handle program crashing when executed using Process object Pin
nemopeti10-Jun-05 2:03
nemopeti10-Jun-05 2:03 
GeneralRe: How to gracefully handle program crashing when executed using Process object Pin
xdansmith10-Jun-05 9:12
xdansmith10-Jun-05 9:12 
GeneralCOM interop question Pin
Christian Graus9-Jun-05 12:49
protectorChristian Graus9-Jun-05 12:49 
GeneralRe: COM interop question Pin
Dave Kreskowiak9-Jun-05 14:52
mveDave Kreskowiak9-Jun-05 14:52 
GeneralRe: COM interop question Pin
Christian Graus9-Jun-05 14:56
protectorChristian Graus9-Jun-05 14:56 
GeneralRe: COM interop question Pin
Dave Kreskowiak9-Jun-05 16:08
mveDave Kreskowiak9-Jun-05 16:08 
GeneralRe: COM interop question Pin
Christian Graus9-Jun-05 16:15
protectorChristian Graus9-Jun-05 16:15 
GeneralGC Pin
devin1239-Jun-05 12:48
devin1239-Jun-05 12:48 
GeneralRe: GC Pin
Christian Graus9-Jun-05 13:01
protectorChristian Graus9-Jun-05 13:01 
GeneralRe: GC Pin
devin1239-Jun-05 13:06
devin1239-Jun-05 13:06 
GeneralRe: GC Pin
Christian Graus9-Jun-05 13:10
protectorChristian Graus9-Jun-05 13:10 
GeneralRe: GC Pin
devin1239-Jun-05 13:19
devin1239-Jun-05 13:19 
GeneralRe: GC Pin
Dave Kreskowiak9-Jun-05 14:46
mveDave Kreskowiak9-Jun-05 14:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.