Hi all,
I want to redirect the console output in real time to a textbox. And if any standard error arrives or Process completed than i have to give one msgbox stating that process completed.Is there any method avalible.Presently I have this code.But it is not working properly
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.TextBox1.Text = String.Empty
Dim clsProcess As New System.Diagnostics.Process()
clsProcess.StartInfo.UseShellExecute = False
clsProcess.StartInfo.RedirectStandardOutput = True
clsProcess.StartInfo.RedirectStandardError = True
clsProcess.StartInfo.FileName = "cmd dir/s"
clsProcess.StartInfo.CreateNoWindow = True
clsProcess.Start()
While (clsProcess.HasExited = False)
Dim sLine As String = clsProcess.StandardOutput.ReadLine
If (Not String.IsNullOrEmpty(sLine)) Then
Me.TextBox1.Text &= sLine & vbCrLf
End If
Application.DoEvents()
End While
Me.TextBox1.Text += "Completed"
End Sub
Thanks in Advance
Dana