Hello Im trying to display a label when my program starts,

to check the server status..
For example if the user is successfully connected to the server it should say on the label "Connected" and if not the label should say "Not Connected" , my Database is located on a remote server.

I tried to disconnect to the internet and use this code but ending up not showing up the form.

    Try
            dataopen()
            If conn.State = ConnectionState.Open Then
                rlabel1.text = "Connected"
            Else
                rlabel1.text = "Not connected"
            End If
        Catch ex As Exception

        End Try

THANKS!

Recommended Answers

All 2 Replies

check for internet connectivity first:

        Try
            If My.Computer.Network.Ping("daniweb.com") Then
                dataopen()
                If conn.State = ConnectionState.Open Then
                    rlabel1.text = "Connected"
                Else
                    rlabel1.text = "Not connected"
                End If
            End If
        Catch ex As Exception
            rlabel1.text = "No Internet Connectivity"
        End Try

Do you able to connect to the server remotely??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.