Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleList the places in the network neighborhood in Visual Basic 6
DescriptionThis example shows how to list the places in the network neighborhood in Visual Basic .
Keywordsnetwork, network neighborhood, Visual Basic
CategoriesFiles and Directories, Internet
 
Note: Add a reference to the COM object "Windows Script Host Object Model."

The program creates a WScript.Shell object and uses its SpecialFolders property to find the NetHood special folder. It then uses Dir to loop through the subdirectories it contains displaying their names.

 
Private Sub Form_Load()
Dim wsh_shell As IWshShell3
Dim special_folders As WshCollection
Dim nethood_path As String
Dim file_name As String

    ' Make a Windows Script Host Shell object.
    Set wsh_shell = CreateObject("WScript.Shell")

    ' Find the Nethood folder.
    Set special_folders = wsh_shell.SpecialFolders
    nethood_path = special_folders.Item("Nethood")

    ' Enumerate the subdirectories in Nethood.
    file_name = Dir$(nethood_path & "\*", vbDirectory)
    Do While Len(file_name) > 0
        lstLinks.AddItem file_name
        file_name = Dir$()
    Loop
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated