从一个文本框重定向标准输出/输入/错误进​​入/ [英] Redirecting the Standard Output/Input/Error into/from a textbox

查看:269
本文介绍了从一个文本框重定向标准输出/输入/错误进​​入/的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个可以用来编辑,编译和运行C程序的VB.NET应用程序。我用Process.StartInfo.RedirectStandardOutput财产。但我不能将其重定向到一个文本框,因为它是字符串类型的不行。

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.

我如何输出来自过程的cl.exe来重定向到我的文本框?

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

推荐答案

您需要重定向到TextBox的Text属性。例如:

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

这篇关于从一个文本框重定向标准输出/输入/错误进​​入/的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆