Public Sub DoPing() ' count for iterations - should be move into a class Static iteration As Integer Dim msg As String Caption = "Ping - " + txtRemoteHost ' update window title If Not Caption = frmMain.Caption Then frmMain.Caption = Caption ping.RemoteHost = txtRemoteHost ping.Timeout = txtTimeout ping.PacketSize = txtPacketSize ping.DoHostResolution = chkDoHostResolution.Value ping.Blocking = chkBlocking.Value ping.DoPing iteration = iteration + 1 ' output formatted message If ping.RemoteHostIP = "" Then msg = "Could not resolve host " + ping.RemoteHost End If Select Case ping.ReplyCode Case 0 msg = ping.PacketSize & " bytes received from {" & _ ping.RemoteHostName & "} <" & _ ping.RemoteHostIP & ">, (" & _ ping.RemoteHost & ") icmp_seq = " & _ iteration & _ ", time = " & ping.Delay & " ms, ttl = " & ping.TimeToLive Case Else msg = ping.ErrorString(ping.ReplyCode) + ": reply code=" & ping.ReplyCode End Select txtOutput = txtOutput + msg + vbCrLf txtOutput.SelStart = Len(txtOutput.Text) End Sub