Option Explicit
Private Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef lpdwFlags As Long, ByVal dwReserved As Long) As Long
Private Sub cmdCheckConnection_Click()
Dim Msg As String
Dim OK As Boolean
OK = CBool(InternetGetConnectedState(0&, 0&))
If OK = True Then Msg = "Du är ansluten till Internet!"
If OK = False Then Msg = "Du är inte ansluten till internet!"
Label1 = Msg
End Sub