Hi All,

In my attempts to give back to the community I will be sharing code in submissions, I have my first being the listbox in my signature and now i'll share the code I use for testing for an internet connection.

The reason for this is that My.Computer.Network.IsAvailable can be misleading as a LAN connection would return true.

The code I use is:
Code:
 Public Function CheckForInternetConnection() As Boolean
                  Try
                Using client = New WebClient()
                    Using stream = client.OpenRead("http://www.google.com")
                        Return True
                    End Using
                End Using
            Catch
                Return False
            End Try
  End Function
I use google.com as being an internet company and a huge one at that it is reasonable to assume their page would be view able 99.99% of the time.

To use the code you can simply then call
Code:
If CheckForInternetConnection() = True Then
'you have a connection do something
End If
enjoy as always feedback is encouraged