Groups | Blog | Home
all groups > dotnet windows forms databinding > november 2004 >

dotnet windows forms databinding : Directing Console.Out and Console.Error to a Textbox


Nevyn Twyll
11/16/2004 10:59:35 AM
I have a set of libraries that do processing output to Console.Out, and
Console.Error.

How do I direct that output to a Textbox on a Windows form in CSharp?

Thanks in advance!

- Nevyn

John M Deal
11/16/2004 11:08:03 AM
For this you can route the In, Out, and Error objects used by the
console to your own objects. To do this simply use the Console.SetIn,
Console.SetOut, and Console.SetError equal to your object. SetIn will
accept a text reader while SetOut and SetError take text writers. Once
you've captured the output you can do what you'd like with it. Hope that
helps.

Have A Better One!

John M Deal, MCP
Necessity Software

[quoted text, click to view]
William Stacey [MVP]
11/16/2004 7:50:49 PM
Just a note. The std output can and will stall your process if the std out
fills the stdout stream - which is not a lot of output (maybe a screen
full). So you may need a seperate thread to read process.stdout into your
own output stream until process done.

--
William Stacey, MVP
http://mvp.support.microsoft.com

[quoted text, click to view]
AddThis Social Bookmark Button