hi guys i have backgroundworker that updates picture box that is checking a ping and based on response time picks 1 of 6 different pictures to fill in the box ...kind of looks like a signal bar picture. I set the error image to be the a pic that looks like zero bars but for some reason out of no where it decides its gonna show a error pic of a red X and even tho when debugging i can see that based on the ping response it does tell it to load the proper pic from resources...well it doesn't change it. the background worker is triggered by a timer set to 1000 ms but have raised it as high as 5 seconds and still get error...going to include code and images if i can figure out how lol
Public Sub CheckNetwork()
Dim Result As Net.NetworkInformation.PingReply
Dim SendPing As New Net.NetworkInformation.Ping
Dim ResponseTime As Long '<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Try
Result = SendPing.Send("8.8.8.8")
ResponseTime = Result.RoundtripTime
If Result.Status = Net.NetworkInformation.IPStatus.Success Then
If ResponseTime.ToString > 0 And ResponseTime.ToString < 35 Then
pbInternetStatus.Load("resources\signal5.png")
ElseIf ResponseTime.ToString >= 35 And ResponseTime.ToString < 45 Then
pbInternetStatus.Load("resources\signal4.png")
ElseIf ResponseTime.ToString >= 45 And ResponseTime.ToString < 65 Then
pbInternetStatus.Load("resources\signal3.png")
ElseIf ResponseTime.ToString >= 65 And ResponseTime.ToString < 85 Then
pbInternetStatus.Load("resources\signal2.png")
ElseIf ResponseTime.ToString >= 85 Then
pbInternetStatus.Load("resources\signal1.png")
End If
Else
pbInternetStatus.Load("resources\signal0.png")
End If
Catch ex As Exception
End Try
End Sub
Private Sub bgwCheckNetwork_DoWork(sender As Object, e As ComponentModel.DoWorkEventArgs) Handles bgwCheckNetwork.DoWork
CheckNetwork()
End Sub
Private Sub tmrNetCheck_Tick(sender As Object, e As EventArgs) Handles tmrNetCheck.Tick
If Not bgwCheckNetwork.IsBusy Then
bgwCheckNetwork.RunWorkerAsync()
bgwCheckNetwork.Dispose()
End If
End Sub
Image without any error :
Image showing the error :