It is fairly straightforward to use Visual Studio 2005 or 2008 to define application settings at design time. I love this feature because it saved me lots of code lines. It is of cource to manually hook the control events, for instance, a check box is checked, with the status/value of a specific setting variable, or render the value of the setting var with a control. However, this is tedious. It is ideal to data-bind the setting variable to a control, and here is how:
In the figure below, I demonstrate linking the check box’s ‘checked’ status to the boolean setting varible ‘bDirectLogin’.
1. Select the checkbox to data bind
2. In the property window, unfold the ApplicationSettings node
3. Click the column in the ‘Checked row’, and all the possible variables that can be hooked to the control property will be shown, and select it!
4. That is almost done. Remember to save the setting when application exit:
5. Still not perfect! Some times, you will find that the bound setting varible is not working properly, even you modified it, it does not change. There is no way to work around this so far, just redo the above process. Compile and have a cup of coffee now!