VB.NET
소스 Imports System.Net.NetworkInformation

Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Start()
End Sub
Private Function IsConnectionAvailable() As Boolean
Dim url As New System.Uri("http://www.vnote.kr")
Dim req As System.Net.WebRequest
req = System.Net.WebRequest.Create(url)
Dim resp As System.Net.WebResponse
Try
resp = req.GetResponse()
resp.Close()
req = Nothing
Return True
Catch ex As Exception
req = Nothing
Return False
End Try
End Function

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim myNA() As NetworkInterface = NetworkInterface.GetAllNetworkInterfaces

Label2.Text = myNA(0).Speed

If IsConnectionAvailable() = True Then
Label1.Text = "Connected!"
Label1.ForeColor = Color.Green
Else
Label1.Text = "Not connected!"
Label1.ForeColor = Color.Red
End If
End Sub
End Class