Console through a Winform 
Author Message
 Console through a Winform

Is it possible to open up a console and write to it? If I have the
following:

private void Form1_Load(object sender, System.EventArgs e)
{
    Console.WriteLine("Form {0} has loaded", this.Name);

Quote:
}

In debug mode this writes to the output window. In release mode nothing
happens.

Bonus question: If I make a console application and build a release version
and run it, the console immediately closes upon finishing. What do you have
to do to keep the window open after it finishes (other than run the exe from
a command prompt)?



Mon, 01 Nov 2004 02:08:06 GMT  
 Console through a Winform
Hello,

To block a Console application when it completes, you may use the Read or
ReadLine method to block it. This is a sample code:

Console.WriteLine("Please press the Enter key...");
Console.ReadLine();

Hope it helps.

Best regards,

Lion Shi, MCSE, MCSD
Microsoft Support Engineer

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.  2001 Microsoft Corporation. All rights
reserved.
--------------------
    From: "nautonnier" <OnTheLambFromAllThatSpam>
    Subject: Console through a Winform
    Date: Wed, 15 May 2002 12:08:06 -0600
    Lines: 17
    X-Priority: 3
    X-MSMail-Priority: Normal
    X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
    X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

    Newsgroups: microsoft.public.dotnet.languages.CSharp
    NNTP-Posting-Host: edge1a.lmco.com 192.31.106.194
    Path: cpmsftngxa08!tkmsftngp01!tkmsftngp02
    Xref: cpmsftngxa08 microsoft.public.dotnet.languages.csharp:61087
    X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

    Is it possible to open up a console and write to it? If I have the
    following:

    private void Form1_Load(object sender, System.EventArgs e)
    {
        Console.WriteLine("Form {0} has loaded", this.Name);
    }

    In debug mode this writes to the output window. In release mode nothing
    happens.

    Bonus question: If I make a console application and build a release
version
    and run it, the console immediately closes upon finishing. What do you
have
    to do to keep the window open after it finishes (other than run the exe
from
    a command prompt)?



Tue, 02 Nov 2004 16:59:15 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Runtime detection: Console App or WinForm?

2. Porting a console Application to Winform App

3. console window when I execute a WinForm

4. How to get WinForm Variables for other WinForm

5. Running Console process without console ?

6. Executing a console application without it opening a console

7. Starting a console application without the console window

8. Building a Console Program without the Console Window (HELP)

9. clear console screen, and sleep() functions in the console window

10. how to use a console window in a win32 application..-- not console application

11. Console control in console application

12. Invoking a console app and hiding the console.

 

 
Powered by phpBB® Forum Software