[VB.NET]Ping an IP with Response Time 07-17-2013, 10:16 PM
#1
Alright, so lets add to our form: 2 Labels, 2 TextBox Controls and 1 Button. Make your form look something along the lines of this:
![[Image: o5U1HmC.png]](http://i.imgur.com/o5U1HmC.png)
View the code for your project, and paste this function in:
Go back to your design, double click your button and paste this code:
If you did it correct, you should see something like this:
![[Image: o5U1HmC.png]](http://i.imgur.com/o5U1HmC.png)
View the code for your project, and paste this function in:
Code:
Public Function Ping(ByVal server As String) As String
Dim ElapseTime As New Stopwatch
ElapseTime.Start()
My.Computer.Network.Ping(server)
ElapseTime.Stop()
Return ElapseTime.Elapsed.TotalSeconds.ToString("N")
End Function
Go back to your design, double click your button and paste this code:
Code:
TextBox2.Text = Ping(TextBox1.Text) & " Seconds"
If you did it correct, you should see something like this:
![[Image: DOF8d4I.png]](http://i.imgur.com/DOF8d4I.png)
(This post was last modified: 07-17-2013, 11:50 PM by Dismas.)
![[Image: GiXvY27.png]](http://i.imgur.com/GiXvY27.png)