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:

Anonymous said...

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.

Zezao Software said...

Many thanks.
Very usefull post for me.

phildonnia said...

Awesome, thanks!

Anonymous said...

Thank you so much for this post!!

Very Simple!
Very Helpful!!

Anonymous said...

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

Anonymous said...

very good!

Anonymous said...

YEEEAAAHHH! Massive help, thank you VERY MUCH!

^_^

Anonymous said...

:D LOVE IT THANKKS!!!!

Anonymous said...

Thank you for the post.

Anonymous said...

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

Mark M. said...

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

Mark.

Mark M. said...

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

Mark.

Anonymous said...

omg it works!!!!