![]() |
![]() |
![]() |
Clear the console output I've Googled and also gone through the .NET Framework's Console class members but I don't seem to find an equivalant of [CMD]tput clear[/CMD] or [CMD]clrscr()[/CMD]. Is there a way I can clear the console ouput using VB.NET?
Sathyaish Chakravarthy
There seems to be a [METHOD]Clear[/METHOD] in the LongHorn prelim. documentation but none that I can find for .NET 1.0.3705.
Sathyaish Chakravarthy
Yes, there doesn't seem to be any way to directly manipulate the contents of .NET consoles. That's probably because they're attachable to text streams.
Chris Nahr
I've developed Win32 console apps too, but to my knowledge, even Win32 does not expose an entry point to clear the console, while it does provide for flushing console buffers.
Sathyaish Chakravarthy
There's no Clear() function but you can directly manipulate the screen buffer to achieve the same effect. To clear the console, either use FillConsoleOutputCharacter with a space character or use ScrollConsoleScreenBuffer to scroll away all existing lines.
Chris Nahr
Thanks for the help. I guess you are right. This guy uses FillConsoleOutputCharacter too.
Sathyaish Chakravarthy
Someone also pointed me a MSKB which seemed to have the answer, if anyone else is also interested.
Sathyaish Chakravarthy
|