logo VB.Net - Special Directories
Guide Contents
DigitalDan Home Page


Private Shared Function AddSlash(directory As String) As String
if directory="" then return ""
if directory.Length = 1 then directory &= ":"
If Mid(directory, directory.Length, 1) <> "\" Then directory &= "\"
Return directory
End Function

Special Directories
If you need to find a special/system directory, you can select the appropriate line from the following code.
NOTE When working with the system directories, you can encounter folders/files that are locked by Windows and experience run-time errors. All folder/file access should be protected by a "Try ... End Try" and pay particular attention to "Catching" the unable to access errors.
Dim directory As String directory = My.Computer.FileSystem.SpecialDirectories.Desktop
directory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
directory = My.Computer.FileSystem.SpecialDirectories.MyMusic
directory = My.Computer.FileSystem.SpecialDirectories.MyPictures
directory = My.Computer.FileSystem.SpecialDirectories.ProgramFiles
directory = My.Computer.FileSystem.SpecialDirectories.Programs
directory = My.Computer.FileSystem.SpecialDirectories.Temp


DigitalDan.co.uk ... Hits = 175