Configuration files for Windows Forms Applications
Since I know I'll run across this again ...
In my iTunes Playlists to Xml application I wanted to allow users the ability to persist their name across sessions. The supported method seems to be using application configuration files; in my case, something like iTunesApplication.exe.config. However, try as I could, I just couldn't find anything solid on how to create the configuration file.
First, I had to add a reference to "System.configuration" (in References). I'm still baffled on why you sometimes need to add a reference, and other times you can just add it to the top of the code-behind file.
Once that was done using System.Configuration; worked and I was able to use Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);.
Next an "Application Configuration File" needed to be added, called app.config, and an appSettings element added within. Adding add elements with key and value attributes was the final step.
Now building the application resulted in an iTunesApplication.exe.config file being created, and my config checks working as expected.
Search
Links of Note
Support This Site
If my blog was helpful to you, then please consider visiting my Amazon Wishlist.