Hi People,
Im trying to do a simple Loop where by an IP address is pinged (Using My.computer.net work.ping) and the results, true or false, are used to invoke another line of code.
Basically if the IP is pingable (true) image A is displayed if it is not (false) then image B is.
The code i am using is as follows
The code compiles fine however it doesnt seem to loop the ping command. For example unplugging the network cable from the target machine and plugging it back in doesnt result in the app showing image A then B (A= Connected B= Disconnected). I thought that by looping the Network.ping, it will continuously do so until the arguement is reached (true)
Im new to VB.NET environment so any suggestions or advice you can give would be great.
Thanks in advance
Sy
Im trying to do a simple Loop where by an IP address is pinged (Using My.computer.net work.ping) and the results, true or false, are used to invoke another line of code.
Basically if the IP is pingable (true) image A is displayed if it is not (false) then image B is.
The code i am using is as follows
Code:
Dim IPAddress As String = "192.168.1.122"
If My.Computer.Network.Ping(IPAddress) = False Then
Do Until True
Loop
PictureBox1.Visible = True
Else
PictureBox2.Visible = True
End If
End Sub
Im new to VB.NET environment so any suggestions or advice you can give would be great.
Thanks in advance
Sy
Comment