Skip to content

Console opens with WinForms #1560

@ghost

Description

I made a test program WinForm, but when I open it, the program opens with CMD, but I didn’t want to. How to fix it?

  • Screen:

Error

  • Code:

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

class MForm : Form {
public MForm() {
Text = "Programm";

    ms.Parent = this;
    
    ToolStripMenuItem file = new ToolStripMenuItem("&File");
    ToolStripMenuItem exit = new ToolStripMenuItem("&Exit", null,
        new EventHandler(OnExit));          
    exit.ShortcutKeys = Keys.Control | Keys.X;
    file.DropDownItems.Add(exit);

    ms.Items.Add(file);
    MainMenuStrip = ms;
    Size = new Size(250, 200);

    CenterToScreen();
}

void OnExit(object sender, EventArgs e) {
   Close();
}

}

class MApplication {
public static void Main() {
Application.Run(new MForm());
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions