Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.76 KB | None | 0 0
  1. Public Class Form1
  2.     Public Shared Function GetPingMs(ByRef hostNameOrAddress As String)
  3.         Dim ping As New System.Net.NetworkInformation.Ping
  4.         Return ping.Send(hostNameOrAddress).RoundtripTime
  5.     End Function
  6.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  7.         If My.Computer.Network.IsAvailable Then
  8.             Dim a As String
  9.             a = GetPingMs(TextBox2.Text)
  10.             Dim tb2 As String = " ( " + TextBox2.Text + " ) = "
  11.             Try
  12.                 RichTextBox1.AppendText(Environment.NewLine + "Response time -" + tb2 + "" + a)
  13.             Catch ex As InvalidCastException
  14.             End Try
  15.         Else
  16.             MsgBox("No network")
  17.         End If
  18.     End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement