Alternatively you could write an application that starts up and only runs
the original application...
So you call in your orginal app:
// in the Main Form
public static void OnRestartReques t()
{
Process.Start ( "Restarter. exe" );
Close(); // or Application.Exi t() ??
}
Then have the Restarter app simply call your original app, wait a few secs
maybe, before it closes...
public static void Main()
{
System.Threadin g.Thread.Sleep ( 3000 ); // time for old app to shut
down
Process.Start ("FirstApp.e xe" );
}
Not very neat though... You should probably look at the reasons your wanting
to restart the application in the first place.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:ur******** ******@tk2msftn gp13.phx.gbl...
Jacek,
In this case, you would probably need another application monitoring
the original application. Of course, you run into the problem of what
happens if the application monitoring the application that originally was
running breaks down.
All in all, you should probably not do this, and let the user restart
the app, logging all information necessary to track down the issue at a
later date.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Jacek Jurkowski" <jj********@dat acomp.szczecin. pl> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. .. Could anybody help me to write proper
code to restart my application?
public static void OnRestartReques t()
{
...
}
Restart is needed after exception handled and
may occur anytime in application life time ...