kshadow22

Check Internet Status Visual Basic

Jun 29th, 2015
236
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. http://www.youtube.com/watch?v=8w7l8OCd51I <- Additional Help and Support
  2. Code:
  3.  
  4. Imports Microsoft.Win32
  5. ________________________________________________________
  6.  
  7. Dim internetStatus As Boolean
  8.  
  9. Private Sub internetCheck_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles internetCheck.DoWork
  10.  
  11. System.Threading.Thread.Sleep(1000)
  12. If My.Computer.Network.IsAvailable Then
  13. internetStatus = True
  14. Else
  15. internetStatus = False
  16. End If
  17.  
  18. End Sub
  19.  
  20. Private Sub internetCheck_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles internetCheck.RunWorkerCompleted
  21.  
  22. If internetStatus = True Then
  23. Label2.Text = "Connection Status : Available"
  24. Else
  25. Label2.Text = "Connection Status : Not Available"
  26. internetCheck.RunWorkerAsync() 'Rename your Background worker to this.
  27.  
  28. End Sub
RAW Paste Data