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 usesReadAllText
to read them into the string namedpatients
.Dim path As String Dim patients As String path = My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\" & "Patients.txt" patients = My.Computer.FileSystem.ReadAllText(path)
See also
Συνεργαστείτε μαζί μας στο GitHub
Μπορείτε να βρείτε την πηγή για αυτό το περιεχόμενο στο GitHub, όπου μπορείτε επίσης να δημιουργήσετε και να εξετάσετε ζητήματα και αιτήματα έλξης. Για περισσότερες πληροφορίες, ανατρέξτε στον οδηγό συνεργατών.