0

I'm working on a little app that requires the results of a dsquery and dsget set in a string for clean up (replacing spaces and other not needed characters). I can display the results of the stream with ReadToEnd - but can't seem to find anything on getting it into a string.

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
1
  • just add parentheses at the end of reader.ReadToEnd. Commented Apr 24, 2014 at 3:08

1 Answer 1

1

just write

dim ProcOutput as string 
ProcOutput = reader.ReadToEnd()

instead of the last line.

if that doesn't help, then I suggest you check out this article:

http://www.codeproject.com/KB/threads/launchprocess.aspx

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.