.Net ramblings
# Monday, 24 May 2004
Environment.SpecialFolder enumeration not showing up in Visual Studio Intellisense

I was using an OpenFileDialog and i wanted it to open at the My Pictures folder for the current user.  So i looked up the msdn docs for how to locate this folder, and i come across the Environment.SpecialFolder enumeration, which has an entry for MyPictures.  Great, my code then was:

this.openFileDialog1.InitialDirectory = Environment.SpecialFolder.MyPictures; 

but this didn't compile, and it didn't show up in Intellisense.  I read a few examples online which used the following syntax:

this.openFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); 

and it worked, although it still didn't show up in Intellisense.  you'd think MS would at least explain this in the docs, weird.


Monday, 24 May 2004 12:34:15 (GMT Daylight Time, UTC+01:00)  #    Comments [1]  .Net Windows Forms

Sunday, 02 January 2005 22:12:00 (GMT Standard Time, UTC+00:00)
Yeah, oddly, Environment.SpecialFolders didn't appear in IntelliSense for me either, but it compiles just fine. Very weird. Posts in other forums seem to indicate this might be a bug with IntelliSense.

- David Stein
OpenID
Please login with either your OpenID above, or your details below.
Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

[Captcha]Enter the code shown (prevents robots):

Live Comment Preview