当我为我的应用程序创建安装程序时,我将在其"我的文档"中创建一个文件夹,该文件夹将用于将文件从我的应用程序保存到.
我想让我的应用程序在保存文件和打开文件对话框打开时自动拉出此目录.现在我的问题是,我需要使用什么字符串来访问"我的文档"中的文件夹?
我知道要获取他们的文档目录,它是这样的:
Dim dir as String
dir = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
Run Code Online (Sandbox Code Playgroud)
但是我的文档中的文件夹怎么样?例如My Documents/Coolest Application Ever Files.这个项目在VB.net.
提前致谢.
看看Path.Combine.
dir = Path.Combine(dir, "Coolest Application Ever Files")
Run Code Online (Sandbox Code Playgroud)
在尝试写入文件之前,请确保它存在.
If Not Directory.Exists(dir) Then
Directory.Create(dir)
End If
Run Code Online (Sandbox Code Playgroud)