Window Forms Application without Command Prompt Window

  • Thread starter Thread starter Luca Paganelli
  • Start date Start date
L

Luca Paganelli

Hi everybody.

I've got a simple but bothering problem.
I've just written a little application in C#.
I've got a set of business logic classes and a window forms GUI released
as a set of libraries (dll).
So the GUI class extends the System.Windows.Forms.Form base class
and anything else (no Main method).

From the class in which I've written the Main method and that's included
in another "project" and namespace and it's compiled as an "exe" project
I do some "configuration" activities (read from files etc) and then
I create an instance of the GUI class with:
Application.Run(new GUIForm());

Everything works very well but I can't close the Command Prompt (DOS)
Window without closing the GUI as well!

As I read in the documentation it seems the only one way not to have
the DOS window opened is to implement a Main method in the GUI class
in which invoking the Application.Run static method.
But my original idea was to package the presentation logic class in a DLL
and call them by another executable class - as I explained.

Do you think there's a solution?

Thaks to everything who'll pay attention for my problem.
Sorry for the "English".

Luca Paganelli.
 
From the class in which I've written the Main method and that's included
in another "project" and namespace and it's compiled as an "exe" project
I do some "configuration" activities (read from files etc) and then
I create an instance of the GUI class with:
Application.Run(new GUIForm());

Everything works very well but I can't close the Command Prompt (DOS)
Window without closing the GUI as well!


Hi Luca,

It sounds like you are compiling your application as a Console Application.
Fixing it depends on how you are compiling your program.

If you are using VS.NET, right-click on the project name in Solution
Explorer and select Properties. Under Common Properties, General the
property grid has an item called Output Type. Make sure that is set to
"Windows Application".

If you're using the command line or a tool that invokes the command line, be
aware the the default is for a Console Application. So, you will have to
change the /target option to a Windows Application, like this:

csc /target:winexe /r:myLibrary.dll myProgram.cs

Joe
 
Thank you very much Joe.
I'm using C#Builder but I found the way to change the "output type" to
Windows Application.

I didn't know there were different "exe" types.
I'm just beginning to work with C#.NET.

Thanks a lot!
Luca Paganelli
 
Back
Top