How do I gracefully exit WinForms app when hitting stop debugging in VS?

*爱你&永不变心* 提交于 2019-12-01 23:38:14

No. When you hit the stop button you can expect your application to not execute anymore code (this allows you to exit infinite loops). If it executed more code, then the stop button would be a close button. The stop button allows you to kill your application without having to open taskman, which would likely kill VS also.

I would suggest having a close menu item on a context menu for the icon. When the user clicks it, your app would close & clean-up, allowing your program to exit gracefully.

If you want more information about the stop debugging button check out the MSDN reference on it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!