C#应用程序中的退出方法
Environment.Exit()方法
Environment.Exit()方法终止进程并将退出代码返回到操作系统-
Environment.Exit(exitCode);
将exitCode设置为0(零)以表明该过程成功完成。
使用exitCode作为非零数字来显示错误,例如-
Environment.Exit(1)-返回值1以显示所需文件不存在
Environment.Exit(2)-返回值2表示文件格式错误。
System.Windows.Forms.Application.ExitThread()
要关闭Windows窗体中的子应用程序或当前线程,请使用System.Windows.Forms.Application.ExitThread()。
private void buttonClose_Click(object sender, EventArgs eventArgs) {
System.Windows.Forms.Application.ExitThread( );
}热门推荐
10 财运虎年祝福语简短语
11 单亲爸爸春节祝福语简短
12 狗狗上厕所训练
13 植物种植祝福语简短
14 翻译考试祝福语朋友简短
15 个人周年庆简短祝福语
16 狗狗怎么训练
17 分别祝福语简短搞笑英文
18 生日广州男生祝福语简短