简体   繁体   中英

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");
        }
    }
}

For Console projects, you can hide the console as follows:

  • Right click the project in the Solution Explorer
  • Select Properties
  • Go the the Application tab in the project properties.
  • Change the Output Type combo box from "Console Application" to "Windows Application".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM