HELP me fix the codes please?

Hi,

Can anyone please help me on this?

The server is supposed to see which computers are online and which are not.
if the workstation are not online the computer should not be seen on the server’s list but if it open again the computer name should appear on the list.

This is the codes I used

Private Sub btnShutdown_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShutdown.Click
On Error Resume Next
If MessageBox.Show("Are you sure you wish to shutdown " & Computer & “?”, “Confirm shutdown”, _
MessageBoxButtons.YesNo, MessageBoxIcon.Question) = System.Windows.Forms.DialogResult.Yes Then
strOperation = “SHUTDOWN”
compIPaddress = “”
compIPaddress = System.Net.Dns.GetHostByName(Computer).AddressList(0).ToString()
If Trim(compIPaddress) = “” Then
MsgBox(“Please select a computer!!!”, MsgBoxStyle.Information, “Computer???”)
Else
trSendMessage = New Thread(AddressOf SendMessage)
trSendMessage.Start()
MessageBox.Show(“Client " & Computer & " has been shutdown.”)
TVComputers.Nodes.Remove(TVComputers.SelectedNode)
End If
End If
End Sub

the shutdown button is working, the problem is, when i open again the computer that is being shutdown on the workstation, it is not appearing on the server’s list. what’s wrong with the code and what should I do?

by the way I used Visual Studio 2008

Thanks a lot in advance.

You shouldn’t use “On error resume next” that’s a bad practice…you should use try catch instead is easier to debug and to manage the error on the application.