Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在制作一个可用于编辑、编译和运行 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