CryoEnix Posted September 28, 2004 Posted September 28, 2004 Hey, say if you didn't know where the user's my documents folder was, I know there's a way of coding the folder like &My Documents% or something. What is the correct syntax, and how is it used? I know there's one for system32 too. Any ideas? Thanks! Quote Chaos is merely logic beyond human comprehension
Administrators PlausiblyDamp Posted September 28, 2004 Administrators Posted September 28, 2004 Dim path As String path = Environment.GetFolderPath(Environment.SpecialFolder.Personal) Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
*Experts* Nerseus Posted September 28, 2004 *Experts* Posted September 28, 2004 Try: string s = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer); string s2 = Environment.GetFolderPath(Environment.SpecialFolder.Personal); string s3 = Environment.SystemDirectory; If Environment.SystemDirectory isn't what you want, try another SpecialFolder enum value. -ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
SiwcDog Posted September 28, 2004 Posted September 28, 2004 The best way to get the path to the mydocuments folder in .net is to use the Environment.GetFolderPath function in the framework. There are also several other very useful folders this function gives you access to. For Example: Dim MyDocumentsPath as string = Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) Side note: The % symbol is used to identify enviroment variables. For instance on my pc %Temp% brings up my Temporary folder. In XP you can determine which enviroment variables are set by going to System Properties, Advanced tab, and clicking the Enviroment Variables button. The problem with using enviroment variables (at least in my organization) is that the system admins tend to delete them or rename them every so often and without warning. Quote
CryoEnix Posted September 28, 2004 Author Posted September 28, 2004 Cheers dudes for the quick response! Now I'm gonna play with some new toys... Quote Chaos is merely logic beyond human comprehension
CryoEnix Posted October 2, 2004 Author Posted October 2, 2004 Cheers guys, is there anything you DON'T know? Quote Chaos is merely logic beyond human comprehension
*Experts* Nerseus Posted October 2, 2004 *Experts* Posted October 2, 2004 is there anything you DON'T know? Lots and lots of things! The big question right now: when will half life 2 *really* come out? -ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
CryoEnix Posted October 2, 2004 Author Posted October 2, 2004 Ooh, now that's a question and a half. Could they be waiting for the Doom 3 release to die down? Quote Chaos is merely logic beyond human comprehension
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.