Question: I want to list all the connected network computers in a listbox. Does anyone know how?

Answer: 
Add a reference to `System.DirectoryServices`.

Add;

```
Imports System.DirectoryServices

```

Then use;

```
Private Delegate Sub UpdateDelegate(ByVal s As String)

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    Dim t As New Threading.Thread(AddressOf GetNetworkComputers)
    t.IsBackground = True
    t.Start()

End Sub

Private Sub AddListBoxItem(ByVal s As String)
    ListBox1.Items.Add(s)
End Sub

Private Sub GetNetworkComputers()
    Dim alWorkGroups As New ArrayList
    Dim de As New DirectoryEntry

    de.Path = "WinNT:"
    For Each d As DirectoryEntry In de.Children
        If d.SchemaClassName = "Domain" Then alWorkGroups.Add(d.Name)
        d.Dispose()
    Next

    For Each workgroup As String In alWorkGroups

        de.Path = "WinNT://" & workgroup
        For Each d As DirectoryEntry In de.Children

            If d.SchemaClassName = "Computer" Then

                Dim del As UpdateDelegate = AddressOf AddListBoxItem
                Me.Invoke(del, d.Name)

            End If

            d.Dispose()

        Next
    Next
End Sub

```
I chopped up some code to get you this, if its not perfect is should be close enough (hope it helps) ...

```
    Private Sub GetCurrentDevices()

    Try

        Dim ps As New System.Diagnostics.ProcessStartInfo("arp", "-a ")

        ps.RedirectStandardOutput = True
        ps.UseShellExecute = False
        ps.WindowStyle = ProcessWindowStyle.Hidden
        ps.CreateNoWindow = True

        Dim sbResults As New StringBuilder

        Using proc As New System.Diagnostics.Process()

            proc.StartInfo = ps
            proc.Start()

            Dim sr As System.IO.StreamReader = proc.StandardOutput

            While Not proc.HasExited
                System.Threading.Thread.Sleep(100)
            End While

            sbResults.Append(sr.ReadToEnd)

        End Using

        Dim IP_Address, MAC_Address, Device_Name As String

        Dim AllOutputLines() As String = sbResults.ToString.Split(vbCrLf)
        sbResults = Nothing

        For Each IndividualOutputLine As String In AllOutputLines

            Windows.Forms.Application.DoEvents()

            If IndividualOutputLine.Contains("dynamic") Then

                Dim Entries() As String = IndividualOutputLine.Split(New String() {}, StringSplitOptions.RemoveEmptyEntries)

                If Entries.Length = 3 Then

                   'Here is your info ...

                    IP_Address = Entries(0)
                    MAC_Address = Entries(1).ToUpper
                    Device_Name = GetComputerName(IP_Address)

                End If

            End If

        Next

          Catch ex As Exception

        MsgBox(ex.ToString)

    End Try

End Sub

Private Function GetComputerName(ByVal IP_Address As String) As String

    Dim ReturnValue As String = cUnknown

    Try

        Dim myIPs As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(IP_Address)
        ReturnValue = myIPs.HostName
        myIPs = Nothing

    Catch ex As Exception
    End Try

    If ReturnValue = IP_Address Then ReturnValue = cUnknown

    Return ReturnValue

End Function

```