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 9080461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:04:47+00:00 2026-06-16T20:04:47+00:00

I am building a C# application, and a problem occurred, I have no idea

  • 0

I am building a C# application, and a problem occurred, I have no idea how to fix it though.

I have a couple of forms, and now I want to add a form which is inherited by another. When I want to view the [Design] screen of the new form, it gives me the following error:

Object reference not set to an instance of an object.

Now I found out that the problem was the connection string, which is located in the app.config file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <connectionStrings>
    <add name="ConnString" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=PVB;Integrated Security=True" providerName="System.Data.SqlClient" />
  </connectionStrings>
</configuration>

This is my code for the connectionString in C#:

string connectionString = ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString;

If I use the string like the one above, I get the Object Reference blabla error. Suprisingly, when I use the following code, the form just works perfectly fine:

string connectionString = "Data Source=.\\SQLEXPRESS;Initial Catalog=PVB;Integrated Security=True";

Does anyone have a clue how I can fix this problem? Yes, I’ve added the System.Configuration reference to the solution, so that’s not the problem, I guess..

  • 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-06-16T20:04:48+00:00Added an answer on June 16, 2026 at 8:04 pm

    Please review the following URL which might resolve your issue. It seems that the problem here is simulair:

    access app.config from inherited form

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

Sidebar

Related Questions

I have a problem with g++ building an application which links to a static
I'm building an application which uses ajax calls for form validations and some others,
Greetings, I have a problem in my application I'm building in. To give the
I am beginner in C# programming. I have encountered small problem during building application
I have a problem with building my application, I get this error: VII 08,
I have a small application which compiles a source file into executable. The problem
Building an application which started as fairly simple, but now got pretty complicated. I
I'm building UDP server application in C#. I've come across a packet checksum problem.
I'm building my first Facebook Connect application, and am running into an odd problem.
The application I'm building right now has problems when using HTTP post. When timeout

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.