473,320 Members | 2,094 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Console Applications

When running a console application through Visual Studio what's the best
method to keep the Window open so I can read "Hello World?"

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/
May 16 '06 #1
7 6355

"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:Op**************@TK2MSFTNGP04.phx.gbl...
When running a console application through Visual Studio what's the best
method to keep the Window open so I can read "Hello World?"

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/


If you are just testing, you can run the app in the debug mode. This will
display a "Press any key to continue..." method. If you don't want this
message, or are running in non-debugger, you can just place a line at the
end of the Main() method that waits for a character to be pressed...

[STAThread()]
public static void Main(params string[] Args)
{
Console.WriteLine("Hello World");
Console.ReadLine();
}

HTH,
Mythran

May 16 '06 #2
Console.ReadLine();

will keep the console window open until you press Enter.

======================
Clive Dixon
Digita Ltd. (www.digita.com)
"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:Op**************@TK2MSFTNGP04.phx.gbl...
When running a console application through Visual Studio what's the best
method to keep the Window open so I can read "Hello World?"

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/

May 16 '06 #3
Console.Readline();

which waits for a keypress so you form remains open until you press enter.

--
"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> schrieb im
Newsbeitrag news:Op**************@TK2MSFTNGP04.phx.gbl...
When running a console application through Visual Studio what's the best
method to keep the Window open so I can read "Hello World?"

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/

May 16 '06 #4
just add:

Console.ReadLine();

"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> a écrit dans le
message de news: Op**************@TK2MSFTNGP04.phx.gbl...
When running a console application through Visual Studio what's the best
method to keep the Window open so I can read "Hello World?"

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/

May 16 '06 #5
"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote:
When running a console application through Visual Studio what's the best
method to keep the Window open so I can read "Hello World?"


Put a Console.ReadLine() at the end of your Main method.

-- Barry
May 16 '06 #6


I usually do this:
(which 1000 other people have said already)

Console.WriteLine (" Press Enter To Exit ");
Console.ReadLine();
That's how all my console apps end.


"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:Op**************@TK2MSFTNGP04.phx.gbl...
When running a console application through Visual Studio what's the best
method to keep the Window open so I can read "Hello World?"

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/

May 16 '06 #7
Thanks to all 100 of you :-)

<%= Clinton Gallagher

"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:Op**************@TK2MSFTNGP04.phx.gbl...
When running a console application through Visual Studio what's the best
method to keep the Window open so I can read "Hello World?"

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/

May 16 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bryan Olson | last post by:
New and improved! Love Python's stack-tracing error messages, but hate the way GUI applications throw the messages away and crash silently? Here's a module to show Python error messages that...
3
by: Dave | last post by:
I created a console app in Visual Studio 2003 using C#. How to I distribute this app after I build it? It is my understanding that a C# app will run on any machine with the Net Framework...
5
by: Barry Mossman | last post by:
Hi, can I detect whether my class is running within the context of a Console application, vs say a WinForm's application ? also does anyone know whether the compiler or runtime is smart enough...
4
by: Rob | last post by:
When issuing... System.Console.Write and WriteLine commands... the program shells out to Command prompt, displays message, and closes... there is no time to view what is shown,,, how can you...
2
by: Jim Heavey | last post by:
Hello, I used VS 2005 to create a console application. Got the application working just fine. I then decided I would create a folder for each of my "console" applications within that project. I...
1
by: Allen Maki | last post by:
I would appreciate if someone helps me. I am reading a book called MS visual c++ .net step by step. I am using Visual C++ .net version 2003. I am trying to learn reading from file using...
4
by: Peter Nimmo | last post by:
Hi, I am writting a windows application that I want to be able to act as if it where a Console application in certain circumstances, such as error logging. Whilst I have nearly got it, it...
24
by: arnuld | last post by:
i want to create a console application in C++ . what can be the 1st step ? NOTE: i did use Google but that gives me some VC++ based links using non-standard libraries.
3
by: Alex | last post by:
Hello, I'm wroting a console utility in VB 2005, and I need the ability to pass parameters to the application when the program runs. For example, if my program is called testing.exe, I need to...
3
by: Sheikko | last post by:
Sincerly is a little bit complicated to explain to you what I have in my mind, but I will try: Above all the problem is the type of data that I want to passe between these two applications. The...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.