Take the 2-minute tour ×

I wrote my first C# program a while ago. It got somewhat big. My .settings file has over 20 different parameters - booleans, sizes, strings, ints. I'd like to provide users with a GUI to change them during runtime instead of editing the app.exe.config file which is somewhat advanced and confusing.

I'm very inexperienced with C# but seems like there should be a better way than for me to manually create a form, drag in labels, inputs, checkboxes, radio buttons, and manually handle all gui events and what happens when values get changed and whatnot. Building this gui by hand seems like a lot of work.

How do you guys handle the settings of a C# app? Can't I generate something from the XML?

share|improve this question
WPF, WinForms? Life is hard-work but it's worth it! ;-) –  Belogix May 16 '13 at 10:35
If you want to change the UI settings like.config file, what is the issue in to Create new form application? –  Akshay Joy May 16 '13 at 10:37
Lazyness.. that's the issue :P But I'm also afraid it'll get too complicated. I'd love to see some code how other people have handled it. –  user1340531 May 16 '13 at 10:38
Most people will crank out completely bespoke settings screens within their applications. I've used a property grid to great affect in the past but have no code to share as that was with an old company, sorry! –  Belogix May 16 '13 at 10:42

2 Answers 2

up vote 2 down vote accepted

In WinForms applications you can add a control to a Form and then click the (PropertyBinding) under (ApplicationSettings) in the Property box.

The dialog allows you to bind properties of the control to a parameter in the config file. It is an extra step during design but it must be done.

These settings will end up in the user config file (I strongly advise against the application config file for this)

You will have to provide the user with a way to specify these settings by either:

  1. having the user edit the config file - very dangerous because it is very easy to mess that up.
  2. allowing the user to manipulate the UI (drag-drop) and save the settings from code. - a lot of work to prevent the user painting himself in a corner.
  3. a separate/standalone designer application that combines 1. and 2.
share|improve this answer

In WPF you can use DataGrid or ListView for your task. However, if you are inexperienced with C# or WPF, it is maybe faster to do the settings form by hand.

share|improve this answer

Your Answer


