Setting Console Colors

  • Thread starter Thread starter Stephen Becker
  • Start date Start date
S

Stephen Becker

I am working on a console app with VB .NET 2003. I would
like to change the color of the output stream (like the
old COLOR command in QBasic) but have not found anything
on MSDN. After searching the web I found how to do it
with VB 6.0 (using the SetConsoleTextAttribute function
in the "kernel32" Lib) but I assume there is a "clean"
and preferred way of doing it using the VB .NET
System.Console namespace.

Any ideas?
 
Stephen said:
I am working on a console app with VB .NET 2003. I would
like to change the color of the output stream (like the
old COLOR command in QBasic) but have not found anything
on MSDN. After searching the web I found how to do it
with VB 6.0 (using the SetConsoleTextAttribute function
in the "kernel32" Lib) but I assume there is a "clean"
and preferred way of doing it using the VB .NET
System.Console namespace.

Any ideas?

Nope. Have to use P/Invoke for it. Since you already have the
necessary API call - then my work is done here :)

Tom Shelton
 
Hello,

Stephen Becker said:
I am working on a console app with VB .NET 2003. I would
like to change the color of the output stream (like the
old COLOR command in QBasic) but have not found anything
on MSDN. After searching the web I found how to do it
with VB 6.0 (using the SetConsoleTextAttribute function
in the "kernel32" Lib) but I assume there is a "clean"
and preferred way of doing it using the VB .NET
System.Console namespace.

There is no managed way to do what you want.

http://www.mentalis.org/soft/class.qpx?id=2

HTH,
Herfried K. Wagner
 
Back
Top