nitefly
New member
- Joined
- Apr 29, 2011
- Messages
- 1
- Programming Experience
- Beginner
Hello, I am new to programming and I am trying to output a dos ping request to a textbox. I was wondering what I am doing wrong? Here is the code:
Thanks in advance.
VB.NET:
Private Function Ping_run() As Boolean
Dim Ping_runProcess As New Process()
Dim Ping_runStartInfo As New ProcessStartInfo()
Dim ComputerID As String = lblIpAddress.Text
Ping_runStartInfo.FileName = "cmd.exe "
Ping_runStartInfo.UseShellExecute = False
Ping_runStartInfo.CreateNoWindow = True
Ping_runStartInfo.Arguments = "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 = output + readerStdOut.ReadLine()
Loop
Return "This is the result of the ping:" + output
End Function
Protected Sub btnPingSubmit_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles btnPingSubmit.Click
txtPing.Text = Ping_run()
End Sub
Thanks in advance.