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 close an application from another form?

how to close an application from another form?

Scheduled Pinned Locked Moved C#
questiontutorial
4 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.
  • D Offline
    D Offline
    donkaiser
    wrote on last edited by
    #1

    Hello, I have 2 forms. once i make my choice of the application i wanna run Form1 is hidden and form2 is showing up. if i want to terminate my program in Form2, Form is still running. I don't wanna instantiate Form1 again in Form2 to close Form1. it's gonna create a new Form1 right? what is the best way to terminate both forms from Form2? Thank you Donkaiser

    L D 2 Replies Last reply
    0
    • D donkaiser

      Hello, I have 2 forms. once i make my choice of the application i wanna run Form1 is hidden and form2 is showing up. if i want to terminate my program in Form2, Form is still running. I don't wanna instantiate Form1 again in Form2 to close Form1. it's gonna create a new Form1 right? what is the best way to terminate both forms from Form2? Thank you Donkaiser

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      Application.Exit()

      1 Reply Last reply
      0
      • D donkaiser

        Hello, I have 2 forms. once i make my choice of the application i wanna run Form1 is hidden and form2 is showing up. if i want to terminate my program in Form2, Form is still running. I don't wanna instantiate Form1 again in Form2 to close Form1. it's gonna create a new Form1 right? what is the best way to terminate both forms from Form2? Thank you Donkaiser

        D Offline
        D Offline
        donkaiser
        wrote on last edited by
        #3

        What i mean is that when i do application.exit() on Form2, the IDE still running in debugging mode. Is it because of Form1 which is hidden and i didn't close it? Donkaiser

        R 1 Reply Last reply
        0
        • D donkaiser

          What i mean is that when i do application.exit() on Form2, the IDE still running in debugging mode. Is it because of Form1 which is hidden and i didn't close it? Donkaiser

          R Offline
          R Offline
          Roy Heil
          wrote on last edited by
          #4

          Really? Application.Exit() should have closed the application, not just Form2. Hiding Form1 should not make a difference. Form2 isn't a separate application that you are spawning from the Form1 application, is it? Roy.

          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