- Oct 24, 2005
- 3,395
- 277
- 136
Hey all,
What would be the simplest way to change this code? It needs to try to ping a site every five seconds for 30 seconds. If it is succesfull at any time then notify the user. This is what I have come up with but the looping part is killing me.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
My.Computer.Network.Ping("google.com")
MsgBox("You are now online! Click here to continue working.")
Catch ex As Exception
MsgBox("Unable to connect to Google, please reboot your device")
End Try
End Sub
What would be the simplest way to change this code? It needs to try to ping a site every five seconds for 30 seconds. If it is succesfull at any time then notify the user. This is what I have come up with but the looping part is killing me.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
My.Computer.Network.Ping("google.com")
MsgBox("You are now online! Click here to continue working.")
Catch ex As Exception
MsgBox("Unable to connect to Google, please reboot your device")
End Try
End Sub
