473,786 Members | 2,571 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6403

"clintonG" <cs*********@RE MOVETHISTEXTmet romilwaukee.com > wrote in message
news:Op******** ******@TK2MSFTN GP04.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.WriteLi ne("Hello World");
Console.ReadLin e();
}

HTH,
Mythran

May 16 '06 #2
Console.ReadLin e();

will keep the console window open until you press Enter.

=============== =======
Clive Dixon
Digita Ltd. (www.digita.com)
"clintonG" <cs*********@RE MOVETHISTEXTmet romilwaukee.com > wrote in message
news:Op******** ******@TK2MSFTN GP04.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.Readlin e();

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

--
"clintonG" <cs*********@RE MOVETHISTEXTmet romilwaukee.com > schrieb im
Newsbeitrag news:Op******** ******@TK2MSFTN GP04.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.ReadLin e();

"clintonG" <cs*********@RE MOVETHISTEXTmet romilwaukee.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*********@RE MOVETHISTEXTmet romilwaukee.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.ReadLin e() at the end of your Main method.

-- Barry
May 16 '06 #6


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

Console.WriteLi ne (" Press Enter To Exit ");
Console.ReadLin e();
That's how all my console apps end.


"clintonG" <cs*********@RE MOVETHISTEXTmet romilwaukee.com > wrote in message
news:Op******** ******@TK2MSFTN GP04.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*********@RE MOVETHISTEXTmet romilwaukee.com > wrote in message
news:Op******** ******@TK2MSFTN GP04.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
2029
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 would otherwise be lost in console-less programs. Graphical applications should not require console windows, but they do need a workable destination for sys.stderr.
3
2294
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 installed. Do I simply copy the exe file to the machine on which the console app is to run?
5
11258
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 to avoid the overhead of writing to the console if it is not visible, eg I am running inside a WinForm application. thanks
4
1320
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 keep the console up in order to view the contents ? Thanks
2
525
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 created a new folder and placed the working application under tht folder (This included the .config file, the driver .cs (void main) and the class which is called by the driver class which does all of the work). I created a new folder for a new...
1
287
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 system::io. I have been asked to build the application, open a console window, change to the project's Debug directory, and run the program with a suitable command line, such as Cppfiles sa.
4
10517
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 doesn't seem to write to the screen in the way I would expect. The output is:
24
2468
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
10115
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 be able to run this: c:\testing.exe c:\test ....and have 'c:\test' passed to the program as a variable. Most of my VB books focus on web forms or windows forms, but not much details on console
3
2243
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 complete application that I want to create consiste of two applications: - the console developped with VS C++, that use some libraries developped with Borland C++ - the GUI of application that interact with the console.
0
9650
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9497
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8992
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6748
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.