01-12-2011, 03:13 PM
My way also works, it's smaller and can be modified to set a timeout. (The 2000 is how much time it'll take to try to ping before timing out)
Code:
If My.Computer.Network.Ping("http://www.google.com", 2000) Then
MsgBox("Connected")
Else
MsgBox("Not Connected")
End If