I am just testing stuff and I want to make a graphical ping utility. Basicly, I can't get to send the output of the command to the textbox.
This is the code that I have:
CODE
Public Class Ping_util
Private Sub Ping_util_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Function Ping_run() As Boolean
Dim Ping_runProcess As New Process()
Dim Ping_runStartInfo As New ProcessStartInfo()
Dim ComputerID As String = Me.ping_what.Text
Ping_runStartInfo.FileName = "cmd.exe "
Ping_runStartInfo.UseShellExecute = False
Ping_runStartInfo.CreateNoWindow = True
Ping_runStartInfo.Arguments = "/D /c ping " + ComputerID
Ping_runStartInfo.RedirectStandardOutput = True
Ping_runProcess.EnableRaisingEvents = True
Ping_runProcess.StartInfo = Ping_runStartInfo
Ping_runProcess.Start()
Dim output As String
Dim readerStdOut As IO.StreamReader = Ping_runProcess.StandardOutput
Do While readerStdOut.EndOfStream = False
output = readerStdOut.ReadLine()
Loop
Me.output_text.Text = "This is the result of the ping:" + output
End Function
Private Sub Start_btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Start_btn.Click
Ping_run()
End Sub
End Class
Is the "output" way the good way to do it?
Thanks in advance,