在我的應用程序的第一個開始,我需要指定一個路徑來保存一些文件。但在打開的文件對話框中,似乎必須選擇要打開的文件。我怎麼可以只指定一個文件夾,而不oppening文件 如C:\設置\如何使用vb.net中的打開文件對話框指定路徑?
這裏是我的代碼
If apppath = "" Then
Dim fd As OpenFileDialog = New OpenFileDialog()
fd.Title = "Select Application Configeration Files Path"
fd.InitialDirectory = "C:\"
fd.Filter = "All files (*.*)|*.*|All files (*.*)|*.*"
fd.FilterIndex = 2
fd.RestoreDirectory = True
If fd.ShowDialog() = DialogResult.OK Then
apppath = fd.FileName
End If
My.Computer.FileSystem.WriteAllText(apppath & "apppath.txt", apppath, False)
End If
我需要爲了選擇一個文件,它的工作,但我只是想選擇一個文件夾。那麼解決方案是什麼?
的OP詢問如何使用* Open File Dialogue *來選擇路徑。 MS的FolderBrowserDialog非常無用(因爲從90年代開始,文件夾樹瀏覽就像Windows 3.0中的舊學校Windows資源管理器一樣沒有更新),並不是每個人都想用它來選擇路徑。 – thebunnyrules 2017-07-08 17:36:01