Console Window and CSharp Form

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

?
 
G

Gheorghe Marius

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.
 
J

Jon Skeet

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.
 
M

Michel Racicot

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.
 
J

Jon Skeet

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top