Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6610981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:54:39+00:00 2026-05-25T19:54:39+00:00

I have some values that I want to be able to set, and the

  • 0

I have some values that I want to be able to set, and the application to load them from some kind of file.

The only concept I can think of, is a simple txt file, that might have the following lines:

DatabaseName = "DB1/test"
DatabasePassword = "password"
Development = "true"

but im thinking it should be in some kind of config file? Plus reading a txt file for these values isnt exactly tidy code. It would be nice if i could get the database name by just saying in my application:

 configfile.DatabaseName

Thanks,
Paul

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:54:39+00:00Added an answer on May 25, 2026 at 7:54 pm

    You really should be using the built in Application Settings

    You can directly access simple settings using the ConfigurationManager

    ConfigurationManager.AppSettings["MySetting"] = "SomeStuff";
    var mySetting = ConfigurationManager.AppSettings["MySetting"];
    

    There is also direct access to your Connection Strings using the ConfigurationManager

    var conn = ConfigurationManager.ConnectionStrings["DevSqlServer"];
    

    All this is stored in XML files, and by default your *.config files.


    To Answer Doomsknight’s question from the comments

    Configuration settings can be done a number of ways, but by default, they are stored in two places.

    Application Level Settings are stored in a configuration file.

    For executable programs this file is located in the same directory as the .exe and is named after the assembly, or executable.

    Example: MyAssembly.config, Another.Assembly.config

    For web applications, the settings are stored in the web.config file (usually) located in the root directory of the web application. These are applied hierarchically and one can be located at each directory level of the Web Application.

    Example: MySite\web.config, MySite\SubDirectory\web.config

    User Scoped Settings are stored in the user profile

    Example: C:\Documents and Settings\USERNAME\Local Settings\Application Data\ApplicationName

    Connection Strings are stored in the <connectionStrings></connectionStrings> section in your config file.

    <connectionStrings>
      <clear />
      <add name="Name" 
       providerName="System.Data.ProviderName" 
       connectionString="Valid Connection String;" />
    </connectionStrings>
    

    These settings can easily be modified directly in the config file, but without writing some code to automatically refresh sections of the config file (which is possible), an application restart is typically needed.

    I hope this helps out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys, I have an application that I want to display some data from
Introduction I have some sort of values that I might want to access several
In my C++ application, I have some values that act as codes to represent
I have the problem, that MSSQL Server 2000 should select some distinct values from
I have an app that I want the user to be able to set
If I have a class with some value member that I want to store
I want to show on the screen some value, that are changeable. I have
I have some code that sets up a dictionary with some defualt values for
I have some code that produces undefined values in an array making no sense.
I have some code here that uses bitsets to store many 1 bit values

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.