Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to restart the program after a function?

How to restart the program after a function?

Scheduled Pinned Locked Moved C#
questiondebuggingtutorial
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Missy Glory
    wrote on last edited by
    #1

    my project have some function,but after one function,i must close the program and debug it again then can run the other function.my teacher ask me to add a button, then user finished one function,click this button,the program like refresh then can use the other one. my question is how to restart the program?hope u can understand what i mean. thank you.

    M L 2 Replies Last reply
    0
    • M Missy Glory

      my project have some function,but after one function,i must close the program and debug it again then can run the other function.my teacher ask me to add a button, then user finished one function,click this button,the program like refresh then can use the other one. my question is how to restart the program?hope u can understand what i mean. thank you.

      M Offline
      M Offline
      Martin 0
      wrote on last edited by
      #2

      Hello, I would assume that you have to build a second update project wich is started (Process.Start) by your main programm (button click). After you started the update programm you can Exit the main programm. Your update program does whatever it should do and restarts the main program again. Be aware that you have to set the "WorkingDirectory" of your Updateprogramm process explicite, because default would be the mainprogram directory, and then you have problems if you have to delet, move, ... files from the main program. All the best, Martin

      M 1 Reply Last reply
      0
      • M Martin 0

        Hello, I would assume that you have to build a second update project wich is started (Process.Start) by your main programm (button click). After you started the update programm you can Exit the main programm. Your update program does whatever it should do and restarts the main program again. Be aware that you have to set the "WorkingDirectory" of your Updateprogramm process explicite, because default would be the mainprogram directory, and then you have problems if you have to delet, move, ... files from the main program. All the best, Martin

        M Offline
        M Offline
        Missy Glory
        wrote on last edited by
        #3

        Martin ,thanks a lot for u r reply...but i still a little confused about this function...sorry

        M 1 Reply Last reply
        0
        • M Missy Glory

          Martin ,thanks a lot for u r reply...but i still a little confused about this function...sorry

          M Offline
          M Offline
          Martin 0
          wrote on last edited by
          #4

          So tell us what confusses you!

          1 Reply Last reply
          0
          • M Missy Glory

            my project have some function,but after one function,i must close the program and debug it again then can run the other function.my teacher ask me to add a button, then user finished one function,click this button,the program like refresh then can use the other one. my question is how to restart the program?hope u can understand what i mean. thank you.

            L Offline
            L Offline
            Leyu
            wrote on last edited by
            #5

            System.Windows.Forms.Application.Restart();

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups