Question regarding console base applications
I see this quite commonly, yet I cannot seem to find information on it anywhere! Quite simply, I want to know how I can output text in such a way that it updates itself, instead of outputting on a new line?
Eg "Process blah blah at 23%" Where the value increases without printing a new line of text.
Thanks in advance, Rob
RobPosted Apr 21, 2006, 1:57 AM
SolitairePosted Apr 20, 2006, 8:36 PM
If you have Visual Studio 2005 (or the Express version of C# 2005) it includes lots of new commands for the console screen. Look them up in the help file. Here is a small example of how you can erase the word "Hello" by moving the cursor up one line and using the Space() function.
This is not available in VS 2003 or 2002.
Console.WriteLine("Hello World");
Console.CursorTop = Console.CursorTop - 1;
Console.Write(Space(5));
You can also indicate the row number after Console.CursorTop =
and the column number after Console.CursorLeft =
After relocating the cursor, anything you Write() after that will replace what was there previously.