简体   繁体   中英

Redirecting the Standard Output/Input/Error into/from a textbox

I was making a VB.NET application that can be used to edit, compile and run C programs. I used the Process.StartInfo.RedirectStandardOutput property. But I'm unable to redirect it to a textbox, since it is not of the string type.

How do I redirect the output coming from the cl.exe process to my textbox?

You need to redirect into the TextBox's Text property. For example:

Dim proc As New Process
proc.StartInfo = New ProcessStartInfo("tracert.exe", "10.0.0.138") _
                 With {.RedirectStandardOutput = True, .UseShellExecute = False}
proc.Start()
TextBox1.Text = proc.StandardOutput.ReadToEnd

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM