-
Simple Console question
Hi All,
I have created a console apllication in visual studio and written it in c#,
the problem i have is when i run it, it displays the console and closes it
straight away, before i have a chance to read the results.
How can i stop the console from closing by itself ?
Is there some way i can get the console to prompt for a key to be pressed
before it will close or something like that ?
Thanks
Steve
-
Re: Simple Console question
Steve,
>How can i stop the console from closing by itself ?
>
>Is there some way i can get the console to prompt for a key to be pressed
>before it will close or something like that ?
Add a Console.ReadLine() at the end of your Main method. Or use Start
Without Debugging (Ctrl+F5) to run the application.
Mattias
===
Mattias Sjögren (VB MVP)
mattias @ mvps.org
http://www.msjogren.net/dotnet/
-
Re: Simple Console question
> I have created a console apllication in visual studio and written it in
c#,
> the problem i have is when i run it, it displays the console and closes it
> straight away, before i have a chance to read the results.
>
> How can i stop the console from closing by itself ?
Run the console program from a command prompt.
Bob.
-
Re: Simple Console question
On Tue, 14 May 2002 15:26:20 -0400, "Bob Rafuse" <bobrafuse@yahoo.com>
wrote:
>> I have created a console apllication in visual studio and written it in
>c#,
>> the problem i have is when i run it, it displays the console and closes it
>> straight away, before i have a chance to read the results.
>>
>> How can i stop the console from closing by itself ?
>
>Run the console program from a command prompt.
>
>Bob.
>
If you are running it from VS.net use Cntl-F5 (start without
debugging) instead of F5 (start).
-
Re: Simple Console question
First of return and close the application insert
this command.
Console.Writeline();
In this manner the program is waiting for.
To close the application press Return key.
Betty Buhr <bettyb@flamingo-code.com> wrote:
>On Tue, 14 May 2002 15:26:20 -0400, "Bob Rafuse" <bobrafuse@yahoo.com>
>wrote:
>
>>> I have created a console apllication in visual studio and written it
in
>>c#,
>>> the problem i have is when i run it, it displays the console and closes
it
>>> straight away, before i have a chance to read the results.
>>>
>>> How can i stop the console from closing by itself ?
>>
>>Run the console program from a command prompt.
>>
>>Bob.
>>
>
>If you are running it from VS.net use Cntl-F5 (start without
>debugging) instead of F5 (start).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|