Console Window and CSharp Form

  • Thread starter Thread starter Michel Racicot
  • Start date Start date
M

Michel Racicot

Why do I obtain a console Window in addition to my CSharp Form when I do the
following code:

using System.Windows.Forms;

class MyWindow: Form
{
}

class MyApp
{
static void Main ()
{
Application.Run (new MyWindow ());
}
}

?
 
Because the output type of your exe is Console Application instead of
Windows Application. Set it wo Windows Application and the consolw thingie
won't appear anymore.

Cheers,
Marius.
 
Michel Racicot said:
Why do I obtain a console Window in addition to my CSharp Form when I do the
following code:

using System.Windows.Forms;

class MyWindow: Form
{
}

class MyApp
{
static void Main ()
{
Application.Run (new MyWindow ());
}
}

Make the project type a console application instead of a Windows
application and you'll get both.
 
Thank you a lot for the quick answer!

Gheorghe Marius said:
Because the output type of your exe is Console Application instead of
Windows Application. Set it wo Windows Application and the consolw thingie
won't appear anymore.

Cheers,
Marius.
 
Jon Skeet said:
Make the project type a console application instead of a Windows
application and you'll get both.

Apologies - I misread the question, thinking that you *wanted* both a
console and a GUI. Make the project type Win32 Application (or whatever
it's called - just not Console).

From the command line, you can build with /t:winexe to do the same
thing
 
Back
Top