Tuesday, May 20, 2008

Finding the "My Documents" folder in VB.net

Finding the My Documents folder in VB.NET (or C#) is pretty simple:

Dim dir as String
dir = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)


There are several other special folders you can get as well:
  • Personal (My Documents also work on devices)
  • MyPictures
  • DesktopDirectory
  • MyMusic
  • StartMenu
  • Startup
  • Favorites
  • ApplicationData
  • CommandApplicationData
  • CommonProgramFiles
  • Cookies
  • History
  • InternetCache
  • LocalApplicationData
  • MyComputer
  • ProgramFiles
  • Programs
  • Recent
Here is another article on using SpecialFolders:

http://www.thescarms.com/dotnet/SpecialFolders.aspx

13 comments:

  1. Thanks, what a relief! This is much easier than in VB 6 where you have to use API and write a module to be able to access special folders easily.

    ReplyDelete
  2. Many thanks.
    Very usefull post for me.

    ReplyDelete
  3. Thank you so much for this post!!

    Very Simple!
    Very Helpful!!

    ReplyDelete
  4. Cool.
    The wonder of the internet!
    Thanks.
    Marc.

    ReplyDelete
  5. YEEEAAAHHH! Massive help, thank you VERY MUCH!

    ^_^

    ReplyDelete
  6. :D LOVE IT THANKKS!!!!

    ReplyDelete
  7. Thank you for the post.

    ReplyDelete
  8. I bookmarked this post it so useful, thank you so much :D :D :D :D

    ReplyDelete
  9. Excellent info...I appreciate that you took the time and saved me some time!

    Mark.

    ReplyDelete
  10. Excellent info...I appreciate that you took the time and saved me some time!

    Mark.

    ReplyDelete

Note: Only a member of this blog may post a comment.