Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide console when opening WinForm

enter image description hereI am trying to write a WinForm directly from Notepad++

But when I run the .exe file it opens a console with no text and also the WinForm If I close it the WinForm closes

How can I hide the console so only the WinForm opens My base code is:

using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace CodeTry
{
    public class Form1336 : Form
    {
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.Run(new Form1336());        
        }

        public Form1336()
        {
            this.Size = new Size(500, 300);
            this.Location = new Point(30, 30);
        }               
    }

Thanks in Advance

Note: When I double-click on try.exe, the console Window opens (the one in black) and also de WinForm. If I close the console the WinForm closes

like image 870
Ypsok Avatar asked Jan 29 '23 01:01

Ypsok


1 Answers

If you're using Visual Studio; under application in the project properties window, change the output type from Console Application to Windows Application.

Project properties window

like image 51
Michael Avatar answered Feb 06 '23 12:02

Michael