I simpily made a consol app which is a TCP-server if i start the normal way like go to the .exe
and start with click it works normaly soo not that is the problem as i think. What i want to do is just read the last line from that consol Here is my code
I got this code from another website
Sub Go()
Dim p As New Process
p.StartInfo.FileName = mainloc & "\ut\server.exe"
p.StartInfo.UseShellExecute = False
p.StartInfo.RedirectStandardOutput = True
AddHandler p.OutputDataReceived, AddressOf HelloMum
MsgBox(p.StartInfo.FileName.ToString)
p.Start()
p.BeginOutputReadLine()
End Sub
Sub HelloMum(ByVal sender As Object, ByVal e As DataReceivedEventArgs)
UpdateTextBox(e.Data)
End Sub
Private Delegate Sub UpdateTextBoxDelegate(ByVal Text As String)
Private Sub UpdateTextBox(ByVal Tex As String)
If Me.InvokeRequired Then
Dim del As New UpdateTextBoxDelegate(AddressOf UpdateTextBox)
Dim args As Object() = {Tex}
Me.Invoke(del, args)
Else
RichTextBox1.Text &= Tex & Environment.NewLine
End If
End Sub
And my problem is when i start this code with the Go sub
the consol app show up for a second then it close by that second before it close it read the first two line then close, Before you ask in the consol app there is this line Console.ReadLine()
I am totally have no idea what i can do.
Thanks for any help