2010-11-26 134 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

回答