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.
- Public Class Form1
- Private Property NetworkI As Devices.Network
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- NetworkI = My.Computer.Network
- Try
- If NetworkI.Ping(TextBox1.Text, 1000) Then
- 'Online
- RadioButton1.Checked = True
- Else
- 'Offline
- RadioButton2.Checked = True
- End If
- Catch ex As Exception
- MessageBox.Show(ex.Message)
- End Try
- End Sub
- 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.
- If MyNetwork.Ping(TextBox1.Text) Then
- MessageBox.Show("Server Pinged")
- End If
0 comments :
Post a Comment