How to check internet connection available in vb.net code?

  • Thread starter Thread starter kgm murugesh
  • Start date Start date
K

kgm murugesh

Guest
I want to check internet connection is available in vb.net code.

I used the following code

Public Shared Function CheckForInternetConnection() As Boolean
Try
Using client = New WebClient()
Using stream = client.OpenRead("Google")
Return True
End Using
End Using
Catch
Return False
End Try
End Function



Sometimes it shows wrong result.

Continue reading...
 
Back
Top