How to create variables and configuration settings for C# Windows Project

I need to store configuration details like Database Connection String,
and other config details in a single location so that I can access it
from any .cs file of the prj.

How is it possible Thru some particular xml file or a text file

PLZ reply asap as its urgent



Answer this question

How to create variables and configuration settings for C# Windows Project

  • Dylan Smith

    There is Built in Mechanism for doing it in .net 2.0 and is called Client Settings. you can use it. Its easy like 1, 2 and 3 Done!

    In Solution Explorer expand the node Properties - > Settings, Add a new setting!

    You can get and set value of that setting as simple as:

    Namespace.Properties.Settings.Defalut.SettingName;

    Cheers ;-)



  • avols143

  • FBorda

    you can use the App.Config file.

    Right click project > add new item > Application Configuration

    I'm not sure entirely how to use it but I thought I will tell you how to add it to your project



  • gburgess

    This feature is not there in .Net 2003. Is there any other way in .Net 2003
  • december_i

    Sounds like this may be a task for the a User Settings action. The settings file, which is written in Xml, is used for such purposes like reading in a value, either for the user or the application .... See Using Settings in C#. / Using My.Settings in Visual Basic 2005

  • How to create variables and configuration settings for C# Windows Project