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

  • Home
  • SEARCH
  • 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 7651499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:31:21+00:00 2026-05-31T11:31:21+00:00

I am new to Windows Forms and I modified the app.config file to have

  • 0

I am new to Windows Forms and I modified the app.config file to have some connection strings, but it never finds it when I use it in code; it retuns null.

<?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <connectionStrings>
            <add name="MySqlConnectionString" connectionString="server=localhost;database=mydatabase;uid=root;" />
        </connectionStrings>
    </configuration>

Also I use this code to see if it’s pulling something

 string val = System.Configuration.ConfigurationSettings.AppSettings["MySqlConnectionString"];

but val is null. Also, under the system.configuration stuff, it says that it’s obsolete and prompts me to use System.Configuration.ConfigurationManager.AppSettings, but the IntelliSense does not give me option “ConfigurationManager”, I only have ConfigurationSettings. I tried typing it and see if the little blue underline came up to include something but nothing comes up.

What could I be doing wrong?

  • 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-31T11:31:22+00:00Added an answer on May 31, 2026 at 11:31 am

    This is because you’re trying to use AppSettings when it’s not in AppSettings.

    Also make sure your reference to System.Configuration is correct.

    • Go into your project, right click References -> Add Reference -> .NET
      -> Go down to System.Configuration and add it.

    You’ll need to switch to this:

    ConfigurationManager.ConnectionStrings["MySqlConnectionString"].ConnectionString;
    

    This should help illustrate the difference between AppSettings and ConnectionStrings:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <connectionStrings>
        <add name="MySqlConnectionString" connectionString="server=localhost;database=mydatabase;uid=root;" />
      </connectionStrings>
      <appSettings>
        <add key="MyAppSetting" value="Hello World!"/>
      </appSettings>
    </configuration>
    

    And then from C#:

    ConfigurationManager.AppSettings["MyAppSetting"]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to use a new settings file in my Windows Forms Application
I am new to C#, Windows Forms, and datagridviews. I have a tabbed form:
I have numerous occurrences of the following in my code: this.webBrowserCtrl.DocumentCompleted -= new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.LoginScreenLoaded);
I am new to Windows forms and having an issue handling all the user
I have a windows form where in I open new threads for server communication.
I made an on screen keyboard with c# Windows Forms. I use Sendkeys.Send() function
When you create a new Windows Forms application, what's the easiest way from dropping
Background In Visual Studio 2008 Create a new Windows Forms Application, this will create
My application is a vb6 executable, but some newer forms in the system are
I have been upgrading an existing .NET Windows Mobile application to use the 3.5

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.