Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. Protected Sub btnList_Click(sender As Object, e As EventArgs)
  2.  
  3. Dim sb As New StringBuilder()
  4. Dim dir As New DirectoryEntry
  5.  
  6. Dim list As New List(Of String)
  7.  
  8.  
  9. ReadRecurs(dir.Children(1), list)
  10.  
  11. list.Sort()
  12. For Each str As String In list
  13. sb.Append(str)
  14. Next
  15. divList.InnerHtml = sb.ToString
  16. End Sub
  17.  
  18. Private Sub ReadRecurs(ByVal entries As DirectoryEntry, ByVal list As List(Of String))
  19. For Each ent As DirectoryEntry In entries.Children
  20. If ent.Children IsNot Nothing Then
  21. ReadRecurs(ent, list)
  22. End If
  23. If ent.SchemaClassName = "computer" Then
  24. list.Add(ent.Name & ", " & ent.Path & "<div />")
  25. End If
  26.  
  27. ent.Dispose()
  28. Next
  29.  
  30. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement