Creating an "output window"

G

Guest

Hi everybody!

I'm creating a very simple VB .NET application that needs to launch the
command line ml.exe compiler.

At the moment I'm redirecting ML's output to a text file and then my app
reads its content and puts it to a textbox for the results.

Is it possible to redirect ML's output as VS does, I mean the output given
line by line as if it was in a console window? A practical example is given
by VS IDE when it launches .NET compilers and output progress is shown in the
output window.

Many thanks,
Progalex
 
P

Phil Harvey

Take a look at System.Diagnostics.Process. Check out the help for the
StandardOutput property, it has good examples.

Dim myProcess As New Process()
Dim myProcessStartInfo As New ProcessStartInfo("ml.exe")
myProcessStartInfo.UseShellExecute = False
myProcessStartInfo.RedirectStandardOutput = True
myProcess.StartInfo = myProcessStartInfo
myProcess.Start()

Dim myStreamReader As StreamReader = myProcess.StandardOutput
' Read the standard output of the spawned process.
Dim myString As String = myStreamReader.ReadLine()
Console.WriteLine(myString)
myProcess.Close()

Hope this helps,

Phil Harvey
 

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

Top