CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2002
    Location
    houston, tx
    Posts
    3

    Question how to clear all text in my Console?

    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]

  2. #2
    Join Date
    Oct 2001
    Location
    Norway
    Posts
    265
    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://]http://support.microsoft.com...;en-us;Q319257

  3. #3
    Join Date
    May 2002
    Location
    Florida USA
    Posts
    27
    Just write a bunch of blank lines!

    Bill F

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured