Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi to all!

I am developing desktop applications and I am a novice developer.

My problem is that I want to make my application more functional. I want to run the same application after using or calling Application.Exit() function. Meaning.. i want to restart the program if there changes made in the settings form of my application. Because, after I call Application.Exit() and expected that the login for will show, the application does end and the Login form didn't show.

Thank you for your help.
Posted
Comments
BillWoodruff 14-Jan-14 23:11pm    
Is this a Windows Forms application ? Or ?
Romeland C. dela Peña 8-Feb-14 4:12am    
yes it is ..

You can use the Restart() Method

C#
private void button1_Click(object sender, EventArgs e)
       {
           Application.Restart();
       }
 
Share this answer
 
Comments
TrushnaK 15-Jan-14 0:15am    
good one...
my 5
try like this also if Application.restart() not worked:-
C#
private void button1_Click(object sender, EventArgs e)
       {
           System.Diagnostics.Process.Start(Application.ExecutablePath);
       }
 
Share this answer
 
Comments
Karthik_Mahalingam 15-Jan-14 0:44am    
5!100% restart() will work,
if not this would be the option..
Romeland C. dela Peña 8-Feb-14 4:17am    
System.Diagnostics.Process.Start(Application.ExecutablePath) worked..

Thank you ..
TrushnaK 9-Feb-14 23:54pm    
welcome romeland...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900