Results 1 to 2 of 2

Thread: .INI ? Save and retrieve application settings to a file

  1. #1

    Thread Starter
    Addicted Member jordan23's Avatar
    Join Date
    Dec 2002
    Posts
    166

    .INI ? Save and retrieve application settings to a file

    How do I save and retrieve application settings and fields in C#. In VB I use .ini files. Thanks.

  2. #2
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    There's a few ways you can do this. Of course you can continue to use .ini files if you wish. System.Configuration.ConfigurationSettings.AppSettings lets you retrieve settings stored in your app.config, but there's no mechanism to save back. Someone on this forum (sorry, can't remember who) wrote a class that allows saving as well. Maybe you can find with a search.

    I've also used a class that holds all the properties I want, then serialize/deserialize to xml - easy to do, but a bit of a pain when you add new properties and need to read in an older version of the xml file.

    Have also put stuff in an xml file and instead of serialization, just manually - like with XmlReader - read in.

    Lately have been getting away from the app.config method for two reasons - you can't save settings, and my users like the have a different .ini/.config file for each user, rather than one for the application.

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