单击MessageBox后,关闭C#控制台应用程序

编程入门 行业动态 更新时间:2024-10-27 06:23:18
本文介绍了单击MessageBox后,关闭C#控制台应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我仍在学习C#提供的所有很酷的技巧.我有一个消息框警报,计时器到期后会弹出.我想知道在用户单击消息框上的确定"按钮之后,是否有可能让控制台应用程序自行终止.在任何情况下,控制台应用程序都会自动最小化到任务栏.

谢谢.

解决方案

尝试一下:

// Terminates this process and gives the underlying operating system the specified exit code. Environment.Exit()

MSDN:Environment.Exit方法

I'm still learning all the cool tricks C# has to offer. I have a messagebox alert that pops up after a timer expires. I'm wondering if it is at all possible to have the console application terminate on its own after the user click the "OK" button on the messagebox. The console app is automatically minimized to the taskbar if that of any circumstance.

Thanks in advance.

解决方案

Give this a go:

// Terminates this process and gives the underlying operating system the specified exit code. Environment.Exit()

MSDN: Environment.Exit Method

更多推荐

单击MessageBox后,关闭C#控制台应用程序

本文发布于:2023-11-12 09:49:13,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1581160.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控制台   单击   应用程序   MessageBox

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!