title: Respond to commandline program question in VB.net
body: <p>I'm using VB.net to have a GUI on top of a commandline program.</p>
  
  <pre><code>Dim sqliProcess As New Process()
  sqliProcess.StartInfo.UseShellExecute = False
  sqliProcess.StartInfo.RedirectStandardOutput = True
  sqliProcess.StartInfo.RedirectStandardError = True
  sqliProcess.StartInfo.FileName = "C:\shell_program.exe"
  sqliProcess.StartInfo.CreateNoWindow = True
  sqliProcess.Start()
  
  Do While Not bw.CancellationPending
      Try
          If Not sqliProcess.StandardOutput.EndOfStream Then
              Debug.Print(sqliProcess.StandardOutput.ReadLine)
          End If
      Catch ex As Exception
          MsgBox(ex.Message, MsgBoxStyle.Critical, "Error reading output")
      End Try
  
      Threading.Thread.Sleep(1)
  Loop
  </code></pre>
  
  <p>Which works and prints out all output from the commandline program. However at some point the commandline program ask for user interaction, eg:</p>
  
  <p><code>Type a number (1/2/3/4):</code></p>
  
  <p>But the commandline program stops after this. I suspect this is because it doesn't receive a valid option.</p>
  
  <p>Is there a way to capture when the commandline program wants user interaction and hold the reading of the stream to be able to enable the user to input something?</p>