News:

Choose a design and let our professionals help you build a successful website   - ITAcumens

Main Menu

computer is connected to the Internet in Visual Basic 6 and Visual Basic 2005

Started by dhilipkumar, Oct 02, 2008, 08:39 PM

Previous topic - Next topic

dhilipkumar

This example shows how to see if the computer is connected to the Internet in Visual Basic 6. This example uses the wininet function InternetGetConnectedState to see if it is connected.

The InternetGetConnectedState function returns 1 if an Internet connection is present or 0 if it is not. The program simply checks the return value and sets a label accordingly.



Private Declare Function InternetGetConnectedState Lib _
    "wininet" (ByRef dwflags As Long, ByVal dwReserved As _
    Long) As Long

Private Sub Form_Load()
    If InternetGetConnectedState(0, 0) = 1 Then
        lblResult.Caption = "Connected"
    Else
        lblResult.Caption = "Not Connected"
    End If
End Sub



This example shows how to see if the computer is connected to the Internet in Visual Basic 2005. This example uses My.Computer.Network.IsAvailable to see if it is connected.



If My.Computer.Network.IsAvailable Then
    lblResult.Text = "Connected"
Else
    lblResult.Text = "Not Connected"
End If


thiruvasagamani

Really its a very great feature Dhilip.......

Thanks for the information dhilip
Thiruvasakamani Karnan


dwarakesh

Hi


  Thanks for the information...

  Are there any other way to do this...