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
 
 
 
 
 
TitleGet the paths to special folders in VB.NET
DescriptionThis example shows how to get the paths to special folders in VB.NET. It uses the Environment.GetFolderPath method to get the folders' locations.
Keywordspath, special folders, VB.NET
CategoriesWindows, VB.NET, Files and Directories
 
When it starts, the program calls the ListFolder subroutine for each of the values defined by the System.Environment.SpecialFolder enumerated type.

Subroutine ListFolder displays the SpecialFolder value as a string and then passes it to Environment.GetFolderPath to get the location of the special folder.

 
Private Sub Form1_Load(ByVal sender As System.Object, ByVal _
    e As System.EventArgs) Handles MyBase.Load
    ListFolder(Environment.SpecialFolder.ApplicationData)
    ListFolder(Environment.SpecialFolder.CommonApplicationData)
    ...
    ListFolder(Environment.SpecialFolder.Templates)
    txtFolders.Select(0, 0)
End Sub

Private Sub ListFolder(ByVal folder_type As _
    System.Environment.SpecialFolder)
    Dim txt As String = folder_type.ToString & ":"
    txtFolders.Text &= String.Format("{0,-25}", txt) & _
        Environment.GetFolderPath(folder_type) & vbCrLf
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated