VB.NET - Showing Online Status

mapadale

Guest
I've got a bit of an issue with VB at the moment, I'm trying to create an "Online Status" using the following which each box would show up in green.

onlinestatus.JPG


I'm using the following code, which does work but then I get errors from VB after I run diagnostics.

Code:
Imports System.Net.Sockets

Dim logonServer As New TcpClient()

Try
            logonServer.Connect("168.144.77.91", 2106)
          
        Catch generatedExceptionName As Exception
            Me.pict_logonServer.BackColor = Color.Red

        End Try
        If logonServer.Connected Then

            Me.pict_logonServer.BackColor = Color.Green
            logonServer.Close()
        End If

Is there something else I can use to show RED for offline and GREEN for online