Window Forms Application without Command Prompt Window

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Luca Paganelli

    #1

    Window Forms Application without Command Prompt Window

    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 "configurat ion" 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.


  • Joe Mayo

    #2
    Re: Window Forms Application without Command Prompt Window

    "Luca Paganelli" <luca.paga@TOGL ILOlibero.it> wrote in message
    news:ZFJvb.1605 4$9k3.15072@tor nado.fastwebnet .it...
    [color=blue]
    > 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 "configurat ion" 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![/color]


    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
    --
    Learn C# with step-by-step tutorials and practical examples. Start your first program, explore lists and parsing, and understand how .NET runs your code.



    Comment

    • Luca Paganelli

      #3
      Re: Window Forms Application without Command Prompt Window

      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

      [color=blue]
      > Hi Luca,
      >
      > It sounds like you are compiling your application as a Console[/color]
      Application.[color=blue]
      > 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,[/color]
      be[color=blue]
      > 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
      > --
      > http://www.csharp-station.com[/color]




      Comment

      Working...