Results 1 to 5 of 5

Thread: SaveFileDialog InitialDirectory to My Documents

  1. #1

    Thread Starter
    Fanatic Member LITHIA's Avatar
    Join Date
    Dec 2002
    Location
    UK, England
    Posts
    575

    SaveFileDialog InitialDirectory to My Documents

    Hi,

    I was just wondering what I have to put into the InitialDirectory property of my SaveFileDialog control to set it to "My Documents" folder...

    obviously you can't just put the address to that directory because its different on each pc. so what's the way of getting it?

    Thanks

  2. #2
    Addicted Member
    Join Date
    Apr 2004
    Location
    Lagos, Nigeria
    Posts
    215
    VB Code:
    1. Dim strFileName As String
    2. strFileName = Environment.GetFolderPath(Environment.SpecialFolder.Personal)

  3. #3
    New Member
    Join Date
    Sep 2004
    Posts
    11
    This is how you set the initial directory for the SaveFileDialog method, here in the following example SaveFileDialog1 is the name of my SaveFileDialog control.


    SaveFileDialog1.InitialDirectory = "C:\..........MyDocuments"

    ' direct the path to whereever your MyDocuments folder is.

    Hope this helps..

    Ron
    Last edited by rmanneth; Dec 11th, 2010 at 05:17 PM.

  4. #4
    Addicted Member
    Join Date
    Apr 2004
    Location
    Lagos, Nigeria
    Posts
    215
    Hi Ranjit,

    What if the document folder is not on drive 'C', what if it's on a network drive?

    This code works fine no matter where the folder is located.

    VB Code:
    1. SaveFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal)

  5. #5
    New Member
    Join Date
    Sep 2004
    Posts
    11

    thank you

    Hey Roby,

    Thanks for that piece of information, sure shot a novice like me never knew that, thanks once again, that hint is really appreciated.

    Ron
    Last edited by rmanneth; Dec 11th, 2010 at 05:17 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width