Console App explanation.

Robeen

New member
Joined
Sep 6, 2012
Messages
4
Programming Experience
10+
Hi,

I've been using Visual Studio [2003, 2005 & now 2010] and I've always done either Windows Web apps.

I have never got into OOP much and want to remedy that - but most of the free tutorials on line seem to be Console oriented and use the Console.WriteLine() . . ..

I must have totally missed the whole Console app thing and I would like to understand it and also understand if I really need to 'understand' console apps in the first place.

I would appreciate any information about console apps that anyone can provide - just so I know the background etc.

Thanks,

Robeen
 
Console Class (System)
The console is an operating system window where users interact with the operating system or with a text-based console application by entering text input through the computer keyboard, and by reading text output from the computer terminal.
Many basic code examples use Console because that environment produce less code and the examples can often quickly be copied and run as is. With a Windows Forms application to get a complete working code example you have to set up UI controls (something best done in Designer), the code must often be split into different methods using event handlers, the code must also ensure UI thread remains responsive and doesn't get blocked which means including multi-threading - all that adding much code complexity to explaining something that in the core is often a simple concept. Console.WriteLine simply means output text to console, in winforms that often means set the Text of a TextBox or Label or some control or display a message using MessageBox.
 
Thanks, JohnH.

I wasn't thinking about the less code part of it - but now it makes sense.

However . . . since the applications I write will not be getting user input from the console . . . how beneficial will it be for me to go down the console path?
 
Console Class (System)

Many basic code examples use Console because that environment produce less code and the examples can often quickly be copied and run as is. With a Windows Forms application to get a complete working code example you have to set up UI controls (something best done in Designer), the code must often be split into different methods using event handlers, the code must also ensure UI thread remains responsive and doesn't get blocked which means including multi-threading - all that adding much code complexity to explaining something that in the core is often a simple concept. Console.WriteLine simply means output text to console, in winforms that often means set the Text of a TextBox or Label or some control or display a message using MessageBox.

And for the same reasons as mentioned above, if you need to knock up an app to automate something quickly, a console app is handy to save time.
 
However . . . since the applications I write will not be getting user input from the console . . . how beneficial will it be for me to go down the console path?
If you need a graphical user interface you must choose the Windows Forms Application project or similar project type that has GUI. If you only need text input and/or output (or neither) the console is sufficient. All the project types have their uses.
 
Thanks, John.
I have another post:
that I haven't had a response to.
I'm not sure if it's because I haven't allowed enough time . . . or if there's something 'wrong' with my post.
I tried sending you a personal message [I'm on an MS Access Forums that allows that] but I couldn't find a way to do it.
I'd appreciate any help/pointers.
Thanks again!
 
You can write quick and simple Console apps with both input and output. For input, use:
stringvariable = Console.ReadLine()

The variable must be a string. If you need it to be a number, the following line should be:
Integer.TryParse(stringvariable, integervariable)

or:

Double.TryParse(stringvariable, doublevariable)
 
Back
Top