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