User Settings file and binding control to "BackColor"

I want to be able to save user settings. The user can create different profiles so that, for example, one profile may have something like red, 26 point font, and another can quickly be selected and it changes to blue, 72 point font. I thought about using the "Settings File" but I wasn't sure if or how to have multiple sets of settings (i.e. different profiles). So my next solution was to load an XML config file into a dataset and bind the dataset elements to a form's controls. This works great, except I want to bind to "BackColor", which is a Color object and not a string, so it causes an error at runtime.

What would be my best solution for a settings file that allows multiple sets of the same user settings, data binding, and the use of non-string objects

Thanks for the ideas,
Shane Blazek


Answer this question

User Settings file and binding control to "BackColor"

  • sticksnap

    If you look at the documentation for the ApplicationSettingsBase class, you will see that it has a constructor which takes a string argument, "settingsKey". This allows you to create multiple sets of settings, which should make having different profiles simple.

  • S Hussain

    I think for user settings, XML file is a very good idea.

    For Color, you can user Color.ToArgb() and Color.FromArgb to get/set the color value, so that you can save the value in the XML.



  • User Settings file and binding control to "BackColor"