469,942 Members | 2,499 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,942 developers. It's quick & easy.

Creating an "output window"


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
Nov 21 '05 #1
3 1097
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
Nov 21 '05 #2
"Progalex" <Pr******@discussions.microsoft.com> schrieb:
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.


RedirectConsole
<URL:URL:http://dotnet.mvps.org/dotnet/samples/misc/RedirectConsole.zip>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #3

Ok, that's very good!

Many thanks, very useful to me.

Progalex
Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Brad Kent | last post: by
reply views Thread by Arne Styve | last post: by
1 post views Thread by Arne | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.