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. Application.Exit isn't working

Application.Exit isn't working

Scheduled Pinned Locked Moved C#
question
3 Posts 2 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.
  • J Offline
    J Offline
    jparsons
    wrote on last edited by
    #1

    I have a form with a menubar and a tab control. Each tab has a set of buttons which inlcude Close and Detach. Once I hit either of these buttons, the code works as expected. However after that my application refuses to exit. The button I've played with the most, Close, has relatively simple code. It iterates through the COntrols on th emain form, finds the tab page it's looking for and then removes it. I've traced my code and I know that Application.Exit() is being called but it's not forcing Application.Run to return. What could be going wrong? Jared jparsons@jparsons.org www.prism.gatech.edu/~gte477n

    R 1 Reply Last reply
    0
    • J jparsons

      I have a form with a menubar and a tab control. Each tab has a set of buttons which inlcude Close and Detach. Once I hit either of these buttons, the code works as expected. However after that my application refuses to exit. The button I've played with the most, Close, has relatively simple code. It iterates through the COntrols on th emain form, finds the tab page it's looking for and then removes it. I've traced my code and I know that Application.Exit() is being called but it's not forcing Application.Run to return. What could be going wrong? Jared jparsons@jparsons.org www.prism.gatech.edu/~gte477n

      R Offline
      R Offline
      Russell Morris
      wrote on last edited by
      #2

      There is a bug in the WinForms code that causes forms to refuse to close if their ActiveControl (ie the control that has focus) is removed. I would expect that this is what you are experiencing. There are a number of workarounds available on the web and newsgroups (time for google[^]!). The easiest I've found is to manually shift focus to an off-screen, permanent control before you remove the other control. -- Russell Morris "Have you gone mad Frink? Put down that science pole!"

      J 1 Reply Last reply
      0
      • R Russell Morris

        There is a bug in the WinForms code that causes forms to refuse to close if their ActiveControl (ie the control that has focus) is removed. I would expect that this is what you are experiencing. There are a number of workarounds available on the web and newsgroups (time for google[^]!). The easiest I've found is to manually shift focus to an off-screen, permanent control before you remove the other control. -- Russell Morris "Have you gone mad Frink? Put down that science pole!"

        J Offline
        J Offline
        jparsons
        wrote on last edited by
        #3

        Ouch. Well the control that I am removing is just a tab page in the tab control. I'll just switch focus to another tab page and then remove the one I want. Shitty bug. Hope they will fix it soon. Jared jparsons@jparsons.org www.prism.gatech.edu/~gte477n

        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