title: How to change ConnectionString class dynamically
body: <p>In my project I am using a <code>ConnectionString</code> class. I want to change my <code>ConnectionString</code> class dynamically in my Winforms application.</p>
  
  <p>I want to create a form (<code>frmServerCon</code>) where I can input new values in textboxes, like <strong>Data Source</strong>, <strong>Initial Catalog</strong>, <strong>Username</strong> and <strong>Password</strong>. When I click the "save" button, the code is supposed to save these new settings in the <code>ConnectionString</code> class and on connect button click it should check if new connection values work for SQL Server before saving.</p>
  
  <p>Right now my <code>ConnectionString</code> class look like this:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  
  namespace 7KProject
  {
      class ConnectionString
      {
          public string DBConn = "Data Source=TCP/IP,PORT;Initial Catalog=DataBase;User ID=user;Password=*******";
  
      }
  }
  </code></pre>
  
  <p>I am unable to find any solution. It would be great if you can help with some working code. Sorry I have no example code.</p>
  
  <p>Thank you.</p>