Dot-Net
保存到使用者“我的文件”中的文件夾
當我為我的應用程序創建安裝程序時,我將在他們的“我的文件”中創建一個文件夾,該文件夾將用於將我的應用程序中的文件保存到其中。
我想讓我的應用程序在保存文件和打開文件對話框打開時自動拉出這個目錄。現在我的問題是,我需要使用什麼字元串來訪問他們“我的文件”中的文件夾?
我知道要讓他們的文件目錄是這樣的:
Dim dir as String dir = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)但是我的文件中的文件夾怎麼樣?例如我的文件/有史以來最酷的應用程序文件。該項目位於 VB.net 中。
提前致謝。
看看
Path.Combine。dir = Path.Combine(dir, "Coolest Application Ever Files")在您嘗試在那裡寫入文件之前確保它存在。
If Not Directory.Exists(dir) Then Directory.Create(dir) End If
Dim filepath As String filepath= IO.Path.Combine(My.Computer.FileSystem.SpecialDirectories.MyDocuments, "test.txt")