Set InitialDirectory to User's Documents Folder

  • Thread starter Thread starter Randy
  • Start date Start date
R

Randy

I'm setting up a SaveAs form and I'd like to have the initial
directory default to the user's documents folder. Since I don't know
what drive that will be be on, etc., I'm wondering how to set this
up. Here is my code:

Dim FileDialogControl As New SaveFileDialog
FileDialogControl.FileName = "myfile.doc"
FileDialogControl.InitialDirectory = "C:\" 'THIS IS THE
LINE THAT I AM WONDERING ABOUT
FileDialogControl.Title = "Save File"
FileDialogControl.ShowDialog()


Can anybody help?
Thanks,
Randy
 
I'm setting up a SaveAs form and I'd like to have the initial
directory default to the user's documents folder. Since I don't know
what drive that will be be on, etc., I'm wondering how to set this
up. Here is my code:

Dim FileDialogControl As New SaveFileDialog
FileDialogControl.FileName = "myfile.doc"
FileDialogControl.InitialDirectory = "C:\" 'THIS IS THE
LINE THAT I AM WONDERING ABOUT
FileDialogControl.Title = "Save File"
FileDialogControl.ShowDialog()

Can anybody help?
Thanks,
Randy

FileDialogControl.InitialDirectory =
System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
 
Back
Top