A Revolution
From the Norm,
Towards Greatness
Home » » Visual Basic: Ping a Website / Check if It's Online

Visual Basic: Ping a Website / Check if It's Online

Written By Unknown on Wednesday, June 15, 2016 | 4:14 PM

Visual Basic: Ping a Website / Check if It's Online

This tutorial is related to "Check for Internet Status" because it's still working with the My.Computer.Network, but instead we are now checking for the status of a Website.To get this script working you won't need allot of things, unless you want to customize it and make it more "special."

What you'l need,
  • TextBox - url spot 
  • Button - send command 
  • Two RadioButtons - to indicate status of the website 

To learn how to get things setup and get more of a hands on tutorial, check out my YouTube bellow. Otherwise, skip the video and grab the source code bellow it.

  1. Public Class Form1
  2.     Private Property NetworkI As Devices.Network
  3.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  4.         NetworkI = My.Computer.Network
  5.         Try
  6.             If NetworkI.Ping(TextBox1.Text1000) Then
  7.                 'Online
  8.                 RadioButton1.Checked = True
  9.             Else
  10.                 'Offline
  11.                 RadioButton2.Checked = True
  12.             End If
  13.         Catch ex As Exception
  14.             MessageBox.Show(ex.Message)
  15.         End Try
  16.     End Sub
  17. End Class

For the ComboBox.text, you can replace it with "1000" or whatever value you would like to place. If you really don't want to add a waiting time, you can just make it.

  1. If MyNetwork.Ping(TextBox1.Text) Then
  2.             MessageBox.Show("Server Pinged")
  3.         End If

Thank you very much for reading / and or watching my YouTube. I hope this helped you out, comment bellow if you have any questions etc. Other than that, have an awesome rest of the day!


About Unknown


Post a Comment