Saving to a folder in the users "My documents"

.net, vb.net

Solution

Have a look at `Path.Combine`.

dir = Path.Combine(dir, "Coolest Application Ever Files")

Just ensure it exists before your try to write to a file there.

If Not Directory.Exists(dir) Then
  Directory.Create(dir)
End If

Problem

When I create the installer for my application I am going to be creating a folder in their "My Documents", this folder is going to be used to save files from my application into. I would like to have my application automatically pull up this directory when the save file & open file dialogs open. Now my question is, what is the string I need to use to get to a folder in their "My documents"? I know to get their my documents directory it goes something like this: ``` Dim dir as String dir = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) ``` But how about a folder in their my documents? Such as My Documents/Coolest Application Ever Files. This project is in VB.net. Thanks in advance.

Original source