Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7036747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:27:40+00:00 2026-05-28T01:27:40+00:00

I need my application to check for internet connectivity on my user’s computer. If

  • 0

I need my application to check for internet connectivity on my user’s computer. If there is, an image is displayed and if there isn’t, a different image is displayed. Here’s the code I used to get this to work:

    Private Sub Window_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded

    If NetworkInformation.NetworkInterface.GetIsNetworkAvailable Then
        Dim bi1 As New BitmapImage
        bi1.BeginInit()
        bi1.UriSource = New Uri("Images\greenbar.png", UriKind.Relative)
        bi1.EndInit()
        Image2.Source = bi1

    Else
        Dim bi2 As New BitmapImage
        bi2.BeginInit()
        bi2.UriSource = New Uri("Images\redbar.png", UriKind.Relative)
        bi2.EndInit()
        Image2.Source = bi2
        MessageBox.Show("INTERNET CONNECTION NOT DETECTED")
        MessageBox.Show("You must be connected to the internet to use some aspects of this application.")
        MessageBox.Show("Please re-establish connection to the Internet and try again, thank you.")
        Me.Close()

    End If
End Sub

I decided to test this on my own computer by changing my default gateway (thereby making it seem as if I lost connection). But I realized that the code still showed that I was connected. So I’m thinking that it’s only checking for connectivity of the interface – which in this case, is my connection to the router (which is true, I was connected to the router).

So, the question: How do I check that the user’s PC is actually connected to the internet? I read the article What is the best way to check for Internet connectivity using .NET? but it’s in C# and I don’t understand that.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:27:40+00:00Added an answer on May 28, 2026 at 1:27 am

    You can use this tool to translate C# to VB.NET or vice-versa:

    Public Shared 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
    

    By the way, the NetworkInterface.GetIsNetworkAvailable method you’ve used checks whether any network connection is available or not – not Internet Connectivity.

    A network connection is considered to be available if any network
    interface is marked “up” and is not a loopback or tunnel interface.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an application, where there is a need to check internet connection
I have a web application inside where i need to check whether the user
I have an application wherein the application will need to check whether one user
How can I check through my application if computer is connected with internet or
It may sound strange, but in my PHP application I need to check if
I need to check if a TCP/IP route already exists from my application and
In my .NET 2.0 application, I need to check if sufficient permissions exist to
I have a path like C:\application\photo\gallery\sketches . Now I need to check whether this
I was trying out a simple JSF application, in which I need to check
I need to develop an application that will check whether the phone is in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.