title: ConnectionString error after form inheritance?
body: <p>I am building a C# application, and a problem occurred, I have no idea how to fix it though.</p>
  
  <p>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:</p>
  
  <blockquote>
    <p>Object reference not set to an instance of an object. </p>
  </blockquote>
  
  <p>Now I found out that the problem was the connection string, which is located in the <code>app.config</code> file: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
    &lt;connectionStrings&gt;
      &lt;add name="ConnString" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=PVB;Integrated Security=True" providerName="System.Data.SqlClient" /&gt;
    &lt;/connectionStrings&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>This is my code for the connectionString in C#:</p>
  
  <pre><code>string connectionString = ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString;
  </code></pre>
  
  <p>If I use the string like the one above, I get the <code>Object Reference blabla</code> error. Suprisingly, when I use the following code, the form just works perfectly fine:</p>
  
  <pre><code>string connectionString = "Data Source=.\\SQLEXPRESS;Initial Catalog=PVB;Integrated Security=True";
  </code></pre>
  
  <p>Does anyone have a clue how I can fix this problem? Yes, I've added the <code>System.Configuration</code> reference to the solution, so that's not the problem, I guess..</p>