title: Verify internet connection in vb.net
body: <p>I wrote this in VB.NET:</p>
  
  <pre><code>Function Net() As Boolean
      Return My.Computer.Network.Ping("216.58.209.142")
  End Function
  
  Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
      Try
          If Net() = True Then
              InternetConnection.ForeColor = Color.Green
              InternetConnection.Text = "OK"
          ElseIf Net() = False Then
              InternetConnection.ForeColor = Color.White
              InternetConnection.BackColor = Color.Red
              InternetConnection.Text = "KO"
          End If
      Catch ex As Exception
          InternetConnection.Text = "KO"
      End Try
  End Sub
  </code></pre>
  
  <p>How to check internet connection every minute? I tried using a BackgroundWorker but I don't know how to use it and my application crashed.</p>