How to restart a program in code?

UncleRonin

Well-known member
Joined
Feb 28, 2006
Messages
230
Location
South Africa
Programming Experience
5-10
In my app I have a bunch of options which can be changed. When these are changed and saved I want the program to restart itself. How can you do this programmatically?

How can I make it close itself completely and THEN reopen itself? Is this actually possible?
 
If the application is not single instance then do this:
VB.NET:
Expand Collapse Copy
Sub restartApplication()
 Me.Hide()
 Process.Start(Application.ExecutablePath)
 Me.Close()
End Sub
New in .Net 2.0 is this method, but there are some info you should read in documentation to know how it works.
VB.NET:
Expand Collapse Copy
Application.Restart()
 
Back
Top