N
n
Hi all,
Got a niggly problem, that I can't seem to crack.
I have a command line process, which I started and capture the
standardoutput with, and I need to update a form with some of the output as
it progresses. But I can't update the form from the Sub OutputHandler2.
Below is my code, any help appreciated.
AddHandler MyProc.OutputDataReceived, AddressOf Me.OutputHandler2
MyProc.StartInfo.UseShellExecute = False
MyProc.StartInfo.ErrorDialog = False
MyProc.StartInfo.CreateNoWindow = True
MyProc.StartInfo.RedirectStandardError = False
MyProc.StartInfo.RedirectStandardOutput = True
MyProc.StartInfo.FileName = process
MyProc.StartInfo.Arguments = param
MyProc.Start()
MyProc.BeginOutputReadLine()
MyProc.WaitForExit()
MyProc.CancelOutputRead()
Sub OutputHandler2(ByVal sendingProcess As Object, ByVal outLine As
DataReceivedEventArgs)
cmdOutput = ""
If Not String.IsNullOrEmpty(outLine.Data) Then
cmdOutput = outLine.Data
' does some uninteresting STUFF here
' NEED TO UPDATE a FORM HERE
End If
End Sub
Got a niggly problem, that I can't seem to crack.
I have a command line process, which I started and capture the
standardoutput with, and I need to update a form with some of the output as
it progresses. But I can't update the form from the Sub OutputHandler2.
Below is my code, any help appreciated.
AddHandler MyProc.OutputDataReceived, AddressOf Me.OutputHandler2
MyProc.StartInfo.UseShellExecute = False
MyProc.StartInfo.ErrorDialog = False
MyProc.StartInfo.CreateNoWindow = True
MyProc.StartInfo.RedirectStandardError = False
MyProc.StartInfo.RedirectStandardOutput = True
MyProc.StartInfo.FileName = process
MyProc.StartInfo.Arguments = param
MyProc.Start()
MyProc.BeginOutputReadLine()
MyProc.WaitForExit()
MyProc.CancelOutputRead()
Sub OutputHandler2(ByVal sendingProcess As Object, ByVal outLine As
DataReceivedEventArgs)
cmdOutput = ""
If Not String.IsNullOrEmpty(outLine.Data) Then
cmdOutput = outLine.Data
' does some uninteresting STUFF here
' NEED TO UPDATE a FORM HERE
End If
End Sub