By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,187 Members | 1,070 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,187 IT Pros & Developers. It's quick & easy.

How to keep Console window open

P: n/a
Hi All,

When I create a Console app in VS.net and run it, the Console window opens
briefly and closes. If I was running a .bat command file, I'd append a
pause stmt at the end. What can I do in VS? I'm a newbie and keeping that
window open would be helpful for studying.

Thanks in advance,
Richard
Aug 30 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Run the application from the command prompt or use the
System.Diagnostics namespace to access Debug.WriteLine and output to
the output window in Visual Studio instead.

Aug 30 '05 #2

P: n/a
Add Console.ReadLine() at the end of Main. That will keep the console open
until you press the "any" key.

--
Peter Bernhardt
SharpSense Software LLC
pe***@SharpBASSense.netURA
"Richard Lionheart" <No***@Nowhere.net> wrote in message
news:en**************@TK2MSFTNGP10.phx.gbl...
Hi All,

When I create a Console app in VS.net and run it, the Console window
opens briefly and closes. If I was running a .bat command file, I'd
append a pause stmt at the end. What can I do in VS? I'm a newbie and
keeping that window open would be helpful for studying.

Thanks in advance,
Richard

Aug 30 '05 #3

P: n/a
Hi Kurt,
Run the application from the command prompt or use the
System.Diagnostics namespace to access Debug.WriteLine and output to
the output window in Visual Studio instead.


Makes sense. But my ideal would be that I could write the app to test which
environment it was running in and then write to the appropriate output
statement, which I'd then encapsulate into MyOutput(string).

Thanks for your knowledgeable and fast response.
Richard
Aug 30 '05 #4

P: n/a
That should be, until you press "Enter".

--
Peter Bernhardt
SharpSense Software LLC
pe***@SharpBASSense.netURA
"Peter Bernhardt" <pe***@spammenot.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Add Console.ReadLine() at the end of Main. That will keep the console open
until you press the "any" key.

--
Peter Bernhardt
SharpSense Software LLC
pe***@SharpBASSense.netURA
"Richard Lionheart" <No***@Nowhere.net> wrote in message
news:en**************@TK2MSFTNGP10.phx.gbl...
Hi All,

When I create a Console app in VS.net and run it, the Console window
opens briefly and closes. If I was running a .bat command file, I'd
append a pause stmt at the end. What can I do in VS? I'm a newbie and
keeping that window open would be helpful for studying.

Thanks in advance,
Richard


Aug 30 '05 #5

P: n/a
> Add Console.ReadLine() at the end of Main. That will keep the console open
until you press the "any" key.
That's exactly what I was looking for. And I'm pretty sure I did the
equivalent in Visual C++ years ago!
That should be, until you press "Enter".
Understood!

Many Thanks,
Richard

"Peter Bernhardt" <pe***@spammenot.com> wrote in message
news:e$**************@TK2MSFTNGP11.phx.gbl... That should be, until you press "Enter".

--
Peter Bernhardt
SharpSense Software LLC
pe***@SharpBASSense.netURA
"Peter Bernhardt" <pe***@spammenot.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Add Console.ReadLine() at the end of Main. That will keep the console
open until you press the "any" key.

--
Peter Bernhardt
SharpSense Software LLC
pe***@SharpBASSense.netURA
"Richard Lionheart" <No***@Nowhere.net> wrote in message
news:en**************@TK2MSFTNGP10.phx.gbl...
Hi All,

When I create a Console app in VS.net and run it, the Console window
opens briefly and closes. If I was running a .bat command file, I'd
append a pause stmt at the end. What can I do in VS? I'm a newbie and
keeping that window open would be helpful for studying.

Thanks in advance,
Richard



Aug 30 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.