Click here to Skip to main content

When you run a console application from visual studio the application run so fast and the console closes that you never see the output.

ohhh...this is an easy fix. Just put down the statement Console.Readline() as the last line in your program. This will keep the window open until you hit the enter key.That's cool!!!!!!
Sign Up to vote bad good
Add a reason or comment to your vote: x
Votes of 3 or less require a comment
See more: C#Visual-Studio
ohhh...this is an easy fix. Just put down the statement Console.Readline() as the last line in your program. This will keep the window open until you hit the enter key.
That's cool!!!!!!
Posted 4 Feb '10
Edited 4 Feb '10


Sign Up to vote bad good
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Alternative 3

Add a call to Console.Readline() or Console.Read() at the end of your Main function this will prever the console from closing until the user presses a key or enter.
  Permalink  
Sign Up to vote bad good
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Alternative 2

But you have to forcefully close the console window..There was not any enter press from key board.I may also hang your console when you close it
  Permalink  
Sign Up to vote bad good
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Alternative 4

If you run the program without debugging, it will prompt you to "enter any key to continue".
 
If you are using a console application, and you use CTRL+F5 (in VS2008) you will get a "Press any key to continue . . . "
 
At least that's the way it's always worked for me.
 
Obviously, if you want to use debugging, then Console.ReadLine( ) is the preferred method.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Your Filters
Interested
Ignored
     
  1. Christian Graus (1,119)
  2. SAKryukov (602)
  3. CRDave1988 (322)
  1. SAKryukov (10,433)
  2. Christian Graus (7,113)
  3. OriginalGriff (5,166)
  4. Abhinav S (4,550)
  5. thatraja (4,376)

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralRe: Palash Biswas Pinmemberaspdotnetdev11:07 4 Feb '10  
QuestionAny way to make that happen in the IDE only? Pinmembersupercat98:12 4 Feb '10  
AnswerRe: Any way to make that happen in the IDE only? Pinmemberaspdotnetdev11:09 4 Feb '10  
GeneralRe: Any way to make that happen in the IDE only? Pinmembersupercat913:28 4 Feb '10  
GeneralRe: Any way to make that happen in the IDE only? Pinmemberaspdotnetdev14:46 4 Feb '10  
AnswerRe: Any way to make that happen in the IDE only? PinmemberAWdrius22:21 4 Feb '10  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web02 | 2.5.120210.1 | Last Updated 20 Feb 2010
Copyright © CodeProject, 1999-2012
All Rights Reserved. Terms of Use
Layout: fixed | fluid