That should tell you if you are connected to a network. It will also tell you which type.

VB Code:
  1. Const NETWORK_ALIVE_AOL = &H4
  2. Const NETWORK_ALIVE_LAN = &H1
  3. Const NETWORK_ALIVE_WAN = &H2
  4. Private Declare Function IsNetworkAlive Lib "SENSAPI.DLL" (ByRef lpdwFlags As Long) As Long
  5. Private Sub Form_Load()
  6.    
  7.     Dim Ret As Long
  8.     If IsNetworkAlive(Ret) = 0 Then
  9.         MsgBox "The local system is not connected to a network!"
  10.     Else
  11.         MsgBox "The local system is connected to a " + IIf(Ret = NETWORK_ALIVE_AOL, "AOL", IIf(Ret = NETWORK_ALIVE_LAN, "LAN", "WAN")) + " network!"
  12.     End If
  13. End Sub