Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

How to: Retrieve the Contents of the My Documents Directory in Visual Basic

The SpecialDirectories object can be used to read from many of the All Users directories, such as My Documents or Desktop.

To read from the My Documents folder

  • Use the ReadAllText method to read the text from each file in a specific directory. The following code specifies a directory and file and then uses ReadAllText to read them into the string named patients.

    Dim path As String 
    Dim patients As String
    path = My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\" & "Patients.txt"
    patients = My.Computer.FileSystem.ReadAllText(path)
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.