Click to See Complete Forum and Search --> : how to clear all text in my Console?


earwicker
May 29th, 2002, 01:05 AM
I'm working on a simple console application, and wish to occasionally clear all the existing text from the screen so I can control the presentation. (a la typing 'cls' at the command line)

Duh.

It oughta be simple, right?

Well, I'm a bit SLOW today, perhaps, since I can't seem to find a way to do it.

System.Console.Out is a TextWriter object, which has a flush() method . . . sounded promising . . . but "This default method does nothing . . . " Just my luck.

Anyone know the score?

Thanks,

---earwicker[ch]

Arild Fines
May 29th, 2002, 06:35 AM
Unfortunately, this isnt simple. The .NET Framework doesnt wrap the Windows console API in any way, so you have to P/Invoke the relevant API calls.
KB-article Q319257[1] deals with this.

[1]]http://support.microsoft.com/search/preview.aspx?scid=kb;en-us;Q319257

bfarley
June 3rd, 2002, 12:48 PM
Just write a bunch of blank lines!

Bill F