c# - How to show message box without console or form in background?
问题描述
I am new to programming (c#). I have seen in VBScript we can show the message box (standalone). I would like to do the same in C#, just for learning, but the code when executed shows a Console or Form in the background along with a messagebox. Is it possible to only show the messagebox when the program is executed?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ConsoleApp4
{
class Program
{
static void Main(string[] args)
{
MessageBox.Show("My message");
}
}
}
解决方案
对于控制台项目,您可以隐藏控制台,如下所示:
- 右键单击解决方案资源管理器中的项目
- 选择属性
- 转到项目属性中的应用程序选项卡。
- 将输出类型组合框从“控制台应用程序”更改为“Windows 应用程序”。
推荐阅读
- python - 如何将进度条与多处理同步
- firebase - 更新服务器时间戳 - firestore
- amazon-web-services - aws api网关和lambda函数超时问题
- java - 加密/解密java到PHP
- ssl - 有没有办法在 Groovy 中使用 JKS Keystore 或 Truststore 为 HTTP 调用实现 SSL?
- python - 使用 NN 在回归中如何使用多个输出计算损失?
- c++ - 通过执行小写到大写转换和小写删除的字符串转换
- mongodb - 在 mongo 中更新集合文档时,在使用它的每个其他文档或集合中更新它
- mysql - 将每月固定值拆分为每天和国家
- python - GNU Radio 3.9 中的 RTL-SDR