1

Hi I am new to application settings in Windows applications.I want to make a settings handler to use in an application which i have to make the settings handler as a class library.How to do this?

Linda Manu
  • 43
  • 10
  • It is pretty impractical. Settings also require entries in the app.config file, only the one for the EXE project is ever used. So every app that uses your class library needs to pay attention to that. The subject of [this Q+A](http://stackoverflow.com/questions/2018625/c-manage-multiple-app-config-files). – Hans Passant Jul 31 '15 at 12:19

2 Answers2

1

Why don't you use an xml file named like the one you suggested? When starting application read data from that and change your app objects.

Spartan
  • 146
  • 1
  • 1
  • 7
  • Thanks Spartan..Yes we can do that way also.But my application needs a settings form like the one i mentioned above and I got the solution for this which i posted below – Linda Manu Aug 13 '15 at 04:56
0

The easiest way to create settings is to use the Visual Studio Settings Designer. To get to the designer, open the project’s Properties pages, and select the Settings tab:

We can see from the Settings grid, settings can have Application scope or User scope. Application settings are those that apply across all users, and that do not change from run to run of the program. Once an Application setting is set in the designer, it can’t be changed in code.

User settings are those that change from user to user, and from run to run of an application. They can be changed in code. User settings are commonly used to store user preferences, such as window size and location. Now fill out the Settings grid.The grid is self-explanatory.The default values are the values given in the Value column.Once you have entered the settings on the grid, save the project and close the Properties pages.

The code to load the settings at runtime is very simple. The designer created a class for us that holds our settings. The class is located in a Properties namespace under our project name.Now we can add a using statement for the settings class in the UI code page.For further reference see the link below:

http://www.codeproject.com/Articles/15013/Windows-Forms-User-Settings-in-C

Linda Manu
  • 43
  • 10