Tuesday, April 5, 2011

Save file info in program c#

Hello,

Is it possible to save some fields in the program, or do I have to write them to a file?

Example:

1) I open a file (with OpenFileDialog) and put it in a FileInfo
2) close the program
3) restart the program
4) go to open -> recent -> select the previous File

Thanks

From stackoverflow
  • you have to put it into a file somwhere... usually you use the configfile for such things. .net manages the work around this configfile very good.

    Phil : any examples? (or link to examples)
    Jack : see http://www.codeguru.com/columns/DotNet/article.php/c7987/ if you use VS you could also use the project settings to generate the configuration that is much easyier to use for the first time.
  • You can use for example the settings file to store the paths to those files(see here)

    Then on startup, lookup the path in settings and create a fileinfo

    Ram : Yes, Good example.
  • See also
    How to decide where to store per-user state? Registry? AppData? Isolated Storage?

0 comments:

Post a Comment