2010-11-26 98 views
0

我正在处理一个小应用程序,它需要将dsquery和dsget的结果设置为字符串进行清理(替换空格和其他不需要的字符)。我可以使用ReadToEnd显示流的结果 - 但似乎无法找到任何有关将其转换为字符串的内容。控制台输出到字符串

VB.net - 的Visual Basic 2010

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 
    Dim p As New Process 
    p.StartInfo.UseShellExecute = False 
    p.StartInfo.CreateNoWindow = True 
    p.StartInfo.FileName = "program" 
    p.StartInfo.Arguments = "lots here" 
    p.StartInfo.RedirectStandardOutput = True 
    p.Start() 
    Dim reader As StreamReader = p.StandardOutput 
    p.WaitForExit() 
    MsgBox(reader.ReadToEnd) 
End Sub 
+0

只是在reader.ReadToEnd`的`末尾添加括号。 – 2014-04-24 03:08:13

回答