I've got a very basic program which use the IP or Hostname of a computer on the network and ping it in order to know if the computer is online or offline by doing a scan every 10 sec and can be started and stopped by a button, and the loop is making the program freeze.
note: The program is still in development.

Public Class PingerFrm
Dim WorkBool As Boolean
Dim StateStr As String
Dim IPStr As String
Private Sub StartBtn_Click(sender As Object, e As EventArgs) Handles StartBtn.Click
WorkBool = True
IPStr = IPTxtBox.Text
Do While WorkBool = True
If My.Computer.Network.Ping(IPStr) Then
StateStr = ("Online")
Else
StateStr = ("Offline")
End If
StateLbl.Text = StateStr
Threading.Thread.Sleep(10000)
Loop
End Sub
Private Sub StopBtn_Click(sender As Object, e As EventArgs) Handles StopBtn.Click
WorkBool = False
End Sub
End Class
Does anyone see what I'm doing wrong or have any ideas ?