将标准输出/输入/错误重定向到文本框或从文本框重定向

发布于 2024-08-28 10:31:17 字数 153 浏览 3 评论 0原文

我正在制作一个 VB.NET 应用程序,可用于编辑、编译和运行 C 程序。我使用了 Process.StartInfo.RedirectStandardOutput 属性。但我无法将其重定向到文本框,因为它不是字符串类型。

如何将 cl.exe 进程的输出重定向到我的文本框?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

白云不回头 2024-09-04 10:31:18

您需要重定向到 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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文