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 2005
DescriptionThis example shows how to list the places in the network neighborhood in Visual Basic 2005.
Keywordsnetwork, network neighborhood, Visual Basic 2005
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 creates a DirectoryInfo object for that folder and loops through the subdirectories it contains displaying their names.

 
Imports System.IO
Imports IWshRuntimeLibrary

Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles MyBase.Load
        ' Make a Windows Script Host Shell object.
        Dim wsh_shell As IWshShell3 = _
            CreateObject("WScript.Shell")

        ' Find the Nethood folder.
        Dim special_folders As WshCollection = _
            wsh_shell.SpecialFolders
        Dim nethood_path As String = _
            special_folders.Item("Nethood")
        Dim di As New DirectoryInfo(nethood_path)

        ' Enumerate the subdirectories in Nethood.
        For Each subdir As System.IO.DirectoryInfo In _
            di.GetDirectories()
            lstLinks.Items.Add(subdir.Name)
        Next subdir
    End Sub
End Class
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated