Memeriksa status koneksi internet VB.Net

alfa6661
- April 06, 2012
0 (0 votes)
Rate :
Potongan kode sederhana untuk Memeriksa status koneksi internet VB.Net

Ini adalah potongan kode sederhana untuk mengetahui status dari koneksi internet dengan menggunakan VB.Net

Source Code

Module Module1
 
    Private Declare Function InternetGetConnectedState _
        Lib "wininet.dll" (ByRef lpdwFlags As Integer, ByVal dwReserved As Integer) As Integer
 
    Private Function IsConnected() As String
        IsConnected = InternetGetConnectedState(0, 0)
        If IsConnected = 1 Then
            'Jika terkoneksi internet
            Return "Koneksi OK"
        Else
            'Jika tidak terkoneksi internet
            Return ("Koneksi Tidak OK")
        End If
    End Function
 
    Sub Main()
        Console.WriteLine(IsConnected)
        Console.ReadLine()
    End Sub
 
End Module

Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter

– Eric S. Raymond

Have a better explanation?

If you have comments about this post. Please write your comments below

No comments associated with this article