Reputation: 373
i am working on an win mobile application . I am running application in background using
e.Cancle = true;
Now i need to relaunch same instance of that application so that i can off that application .
can any one tell me ... how to do this?
Upvotes: 0
Views: 707
Reputation: 28259
You need to:
1) Stop application(Kill process) http://msdn.microsoft.com/en-us/library/system.diagnostics.process.kill.aspx or Exit application http://msdn.microsoft.com/en-us/library/system.windows.forms.application.exit(v=vs.71).aspx
2) Run application again(Start process) http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start(v=vs.71).aspx
Also you may use Restart
method http://msdn.microsoft.com/en-us/library/system.windows.forms.application.restart.aspx
Which way you will choose depends no the your particular situation.
Upvotes: 1
Reputation: 29244
This might do it.
System.Diagnostics.Process.Start(Application.ExecutablePath);
Close();
Upvotes: 0
Reputation: 145880
If the application needs to restart itself this may help you :
http://msdn.microsoft.com/en-us/library/system.windows.forms.application.restart.aspx
You don't actually need to be running a winforms application for this to work - you just need to make sure the System.Windows.Forms DLL is present.
PS. i couldn't get this working for WPF - but I don't actually remember the exact reason right now
Upvotes: 1