windows forms designer - How to restart the c# application without exiting from the application -


how restart c# application program or call

    [stathread]     static void main()     {          application.enablevisualstyles();         application.setcompatibletextrenderingdefault(false);         application.run(new connectpage());      } 

, without exiting program?

i have tried process.start() method method starts process cannot debugged anymore.

try this:

  [stathread]   static void main(   {      application.enablevisualstyles();     application.setcompatibletextrenderingdefault(false);     do{       var page = new connectpage();       application.run(page);     } while (page.somepropertyormethodtokeepanoptiontorestart); } 

keep in mind not true restart, if you're storing things in static properties or fields.

alternatively can along these lines:

system.diagnostics.process.start(system.reflection.assembly.getexecutingassembly().location); application.exit(); 

and in main add

#if debug   system.diagnostics.debugger.launch(); #endif