469,648 Members | 1,709 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,648 developers. It's quick & easy.

Pause console

kai
Hi,
When I use

Console.WriteLine("Hello") in my code, it displays DOS screen so fast,
how do I pause the Console screen?

Thanks

Kai
Nov 20 '05 #1
6 43597
Kai,
The easiest way is to use Console.Read to wait for keyboard input.

Something like:

Public Sub Main()
Console.WriteLine("Hello World")
Console.Read()
End Sub

Of course when you console application runs from the command line, the Read
is not really necessary. It is only needed if your application is run from
Windows Explorer or VS.NET. The February 2004 issue of MSDN Magazine has a
couple of articles that offer some interesting tricks you can do with
Console applications.

Hope this helps
Jay

"kai" <ka******@earthlink.net> wrote in message
news:DJ***************@newsread3.news.atl.earthlin k.net...
Hi,
When I use

Console.WriteLine("Hello") in my code, it displays DOS screen so fast, how do I pause the Console screen?

Thanks

Kai

Nov 20 '05 #2
Hi,

In addition to Jay's comments If you start a console app in the ide
by press ctrl+F5 it will keep the console window open until you press any
key.

Ken
----------
"kai" <ka******@earthlink.net> wrote in message
news:DJ***************@newsread3.news.atl.earthlin k.net...
Hi,
When I use

Console.WriteLine("Hello") in my code, it displays DOS screen so fast,
how do I pause the Console screen?

Thanks

Kai

Nov 20 '05 #3
Hi,

In addition to Jay's comments If you start a console app in the ide
by press ctrl+F5 it will keep the console window open until you press any
key.

Ken
----------
"kai" <ka******@earthlink.net> wrote in message
news:DJ***************@newsread3.news.atl.earthlin k.net...
Hi,
When I use

Console.WriteLine("Hello") in my code, it displays DOS screen so fast,
how do I pause the Console screen?

Thanks

Kai

Nov 20 '05 #4
* "kai" <ka******@earthlink.net> scripsit:
Console.WriteLine("Hello") in my code, it displays DOS screen so fast,
how do I pause the Console screen?


There is no DOS screen. It's a Windows console. What exactly do you
mean by "displays DOS screen so fast"? The window will close
automatically if the application runs from the IDE/Windows and not from
a console window. You can use something like that to prevent the window
from closing:

\\\
If #Debug Then
Console.Read()
End If
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #5
* "kai" <ka******@earthlink.net> scripsit:
Console.WriteLine("Hello") in my code, it displays DOS screen so fast,
how do I pause the Console screen?


There is no DOS screen. It's a Windows console. What exactly do you
mean by "displays DOS screen so fast"? The window will close
automatically if the application runs from the IDE/Windows and not from
a console window. You can use something like that to prevent the window
from closing:

\\\
If #Debug Then
Console.Read()
End If
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #6
Ken,
Cool!

I did not realize that Ctrl+F5, start without debugging, did that!

I can see using Ctrl+F5 and putting a break point on the last statement of
Main, to avoid using the #if Debug method Herfrield showed... (depending on
the app I like the #if debug method also).

Thanks
Jay
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:uv**************@tk2msftngp13.phx.gbl...
Hi,

In addition to Jay's comments If you start a console app in the ide by press ctrl+F5 it will keep the console window open until you press any
key.

Ken
----------
"kai" <ka******@earthlink.net> wrote in message
news:DJ***************@newsread3.news.atl.earthlin k.net...
Hi,
When I use

Console.WriteLine("Hello") in my code, it displays DOS screen so fast, how do I pause the Console screen?

Thanks

Kai


Nov 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Wim | last post: by
1 post views Thread by Dan Williams | last post: by
6 posts views Thread by Mark Broadbent | last post: by
5 posts views Thread by Aaron | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.