CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 3 of 3 FirstFirst 123
Results 31 to 34 of 34
  1. #31
    Join Date
    Nov 2007
    Location
    .NET 3.5 / VS2008 Developer
    Posts
    624

    Re: Store information within program

    Quote Originally Posted by vandel212 View Post
    I see what you are saying, I'll have to check out if I can save to the users new account documents and settings folder. I looked at one of those examples where the person's name changed and it wouldn't work with Environment.UserName. The person did not have anything in the new user account's documents and settings folder, although I did not try to save anything to it. However, I did take your advice and the files are stored in application data now. It is not putting anything in the My Documents folder it's just taking "C:\Documents and settings\jane.smith\My Documents" and turing it into "C:\Documents and Settings\jane.smith\Application Data\Program Name" by removing 'My Documents' and replacing it with 'Application Data\Program Name'.
    and that's what it's suppose to do. Using this method means that you don't have to care about the user name. .Net will get the "Documents and Settings" directory that their Windows account is using, so you don't need to worry about a user name changing.
    ===============================
    My Blog

  2. #32
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: [RESOLVED] Store information within program

    What I suggested doesn't cover the user change scenario, but typically this is a system admin function - in that, a sys admin is responsible for migrating user settings and documents over to the new user account.

    Programs are usually not required to deal with that, unless the spec explicitly states that they do (and even then I would discuss with the pm whether you want to try to solve a problem that really can't be cleanly solved). If a sys admin does it, they know the old user name, they know the new user name, and can easily migrate all the documents and settings providing you following the rules on where to put application data and user data.

  3. #33
    Join Date
    Feb 2009
    Posts
    112

    Re: [RESOLVED] Store information within program

    Quote Originally Posted by Arjay View Post
    Programs are usually not required to deal with that, unless the spec explicitly states that they do (and even then I would discuss with the pm whether you want to try to solve a problem that really can't be cleanly solved). If a sys admin does it, they know the old user name, they know the new user name, and can easily migrate all the documents and settings providing you following the rules on where to put application data and user data.
    Well this program is set up to make sure that the Environment.UserName will work properly and it will for 99% of the users. So I tried to make it as user friendly as possible so that they have to locate their 'My Documents' once. I appricate all the help. Thank you very much.
    - It's a long way to the top if you want to rock n' roll - AC/DC

    Check out my band and support the music:
    www.blueruinmusic.com

  4. #34
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: [RESOLVED] Store information within program

    Only user data goes in My Documents, if you are putting application data (such as temporary files or settings), it doesn't belong there. Application data belongs in the 'Application Data' folder which can be retrieved as mentioned earlier.

    Hopefully that clears up any confusion.

Page 3 of 3 FirstFirst 123

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured