I run a program based on a timer in VB.NET, and it executes just fine when I don't try to retrieve the output. For some reason, though, I constantly get an error on the Dim myOutput line... Can anyone spot my error? output is a string.
Error: StandardOut has not been redirected or the process hasn't started yet.
Code:Dim fetch As New System.Diagnostics.ProcessStartInfo("C:/perlprog.pl") fetch.WindowStyle = ProcessWindowStyle.Hidden Dim executable As System.Diagnostics.Process executable = System.Diagnostics.Process.Start(fetch) Dim myOutput As System.IO.StreamReader = executable.StandardOutput executable.WaitForExit(timer1.Interval) If executable.HasExited Then output = myOutput.ReadToEnd End If If Trim(output) = "" Then output = "No errors (really)." End If lblerr.Text = output




Reply With Quote