我正在制作一个可用于编辑、编译和运行 C 程序的 VB.NET 应用程序。我使用了 Process.StartInfo.RedirectStandardOutput 属性。但我无法将它重定向到文本框,因为它不是字符串类型。
如何将来自 cl.exe 进程的输出重定向到我的文本框?
最佳答案
您需要重定向到 TextBox 的 Text 属性。例如:
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
关于c - 将标准输出/输入/错误重定向到/从文本框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2607865/