今天在编写项目时,需要关闭winform窗口,使用的是system.Enviroment.exit(0),无论是vs运行的程序还是运行exe程序,都发生了”创建窗体句柄错误,未处理的win32exception“这个异常,调试将错误定位在system.Enviroment.exit(0)上,接着使用”System.Environment.Exit(Environment.ExitCode);this.close(),this.dispose()“等语句尝试解决问题,问题依旧;而使用Application.exit()出现关闭窗口的确定框需要点击两次才可以关闭窗口的问题;最后使用Application.ExitThread();将问题解决,反复测试20次,没有出现问题。
winform关闭窗口
推荐阅读
- MySQL 取得小时分钟部分
- maven项目生成war包
- org.apache.rocketmq.remoting.exception.RemotingTooMuchRequestException: sendDefaultImpl call timeout 和 RocketmqRemoting closeChannel: close the connection to remote address[] result: true
- minio 安装 配置 修改秘钥 设置永久访问
- springmvc +mybatis 配置多数据源
- spring 事务隔离级别配置
- Java Map 求交集 并集 差集
- connection closed by foreign host / Permissions 0620 for '/etc/ssh/ssh_host_ed25519_key' are too open 解决方案
- Vim 中文件目录浏览插件——NERD tree
- lnmp安装--linux通过tar.gz源码包安装mysql