|
-
September 24th, 2009, 07:09 AM
#15
Re: Store information within program
 Originally Posted by JonnyPoet
Dont do this is the Properties itself ! Do this where your code wants to read the UserPath
Simple instead of accessing the Properties
Code:
string userpath = Properties.Settings.Default.UserPath;
// do
string userpath = string.Format(@"C:\Documents and Settings\{0}\My Documents\My Pictures", Environment.UserName);
No need to have that code in the Properties. !!
he can't use Environment.UserName in the path. The Environment.UserName can be different from the user name in the path(look at his example a couple of posts up).
Once thing you could do is get each subdirectory in the C:\Documents and Settings directory, then parse the string to see if that matches the first name of the current user(since you can't use the last name). I don't know how your company works, but at mine, I am the only user(other than administrator) on my PC. So in the C:\Documents and Settings directory on my PC, there are only two folders.
===============================
My Blog
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|