Capturing Console Output....

  • Thread starter Thread starter Scott Meddows
  • Start date Start date
S

Scott Meddows

I have a group of objects that I want to be able to echo information (Console.writeline in the NEw(), Add(), etc). The objects will
be used in a service and in my test application (Winform).

Would it be best to capture the std output and echo the information there? And if I did this, HOW do I do it? Any good articles
on this? Would just raising events be better (Kinda would prefer to not do this)?

Thanks
Scott
 
I have a group of objects that I want to be able to echo information (Console.writeline in the NEw(), Add(), etc). The objects will
be used in a service and in my test application (Winform).

Would it be best to capture the std output and echo the information there? And if I did this, HOW do I do it? Any good articles
on this? Would just raising events be better (Kinda would prefer to not do this)?

Thanks
Scott

Scott, you may want to look into the System.Diagnostics.TraceListner
class. Using tacelistners, you can provide debug infromation to
serveral different sources, or even provide custom listners. You can
also turn them on and off at runtime using config file settings...
 
Hi,

Use the process class to do that.


Dim pi As New ProcessStartInfo

Dim p As Process

pi.RedirectStandardOutput = True

pi.FileName = "c:\myconsoleapp.exe"

pi.UseShellExecute = False

Dim sw As New System.IO.StreamWriter("C:\MyOutPut.txt")

p = Process.Start(pi)

sw.WriteLine(p.StandardOutput.ReadToEnd)

p.WaitForExit()

sw.Close()



Ken

------------------------------------

I have a group of objects that I want to be able to echo information
(Console.writeline in the NEw(), Add(), etc). The objects will
be used in a service and in my test application (Winform).

Would it be best to capture the std output and echo the information there?
And if I did this, HOW do I do it? Any good articles
on this? Would just raising events be better (Kinda would prefer to not do
this)?

Thanks
Scott
 
AWESOME!!!!!


Man, I love the .Net framework. That was so easy!!!!

Thanks a lot!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top