title: Change connection string from class library in main application at run-time
body: <p>You can change the connection string at run-time like this. You make the connection string setting available for writing as a separate property inside the MySettings class:</p>
  
  <pre><code>Partial Friend NotInheritable Class MySettings
      Public WriteOnly Property RunTimeConnectionString()
          Set(ByVal value)
              My.Settings("MyConnectionString") = value
          End Set
      End Property
  End Class
  </code></pre>
  
  <p>Then, in some place when the application is being initialized (before using any table adapters of typed datasets), write something like:</p>
  
  <pre><code>My.Settings.RunTimeConnectionString = My.Settings.ProductionConnectionString
  </code></pre>
  
  <p>Where ProductionConnectionString is a simple String setting. It is a User Scope setting so every user can change it (by assigning a value to it, similar to the code above) and save it by calling My.Settings.Save()</p>
  
  <p>This code works well for connection strings which were initially created in the main project and stored in it's settings (= app.config file).</p>
  
  <p>The connection string in the app.config actually has a longer name: MyApp.MySettings.MyConnectionString.</p>
  
  <p>When you have a connection string stored in the app.config in a class library project, and reference that project in the main project, the app.config files will somehow be merged, so the class library has it's settings.</p>
  
  <p>The thing that don't know how to do, is change a setting from the class library at run-time. I could copy the connection string setting from the class library to the main project's app.config. I must keep the same name, which looks something like: MyClassLibrary.My.MySettings.MyConnectionString.</p>
  
  <p>Can the same principle I showed above be somehow applied to this second connection string?</p>