title: Programatically change Endpoint Address in App.config
body: <p>I have a pretty simple TimeClock application written in VB (.net4) that I'm trying to add to. The addition will allow the user to change where the service is coming from. </p>
  
  <p>In short, I want to be able to programatically change the  in the App.Config file.</p>
  
  <p>For reference: </p>
  
  <pre><code>&lt;client&gt;
          &lt;endpoint address="net.tcp://localhost:8090/MyService/TimeClockService"
                    binding="netTcpBinding" 
                    contract="TimeClockService.ITimeClock" 
                    name="tcpBinding"&gt;
              &lt;identity&gt;
                  &lt;userPrincipalName value="susnick-PC\susnick" /&gt;
              &lt;/identity&gt;
          &lt;/endpoint&gt;
      &lt;/client&gt;
  </code></pre>
  
  <p>The only part i'm really trying to change is the 'address'.</p>
  
  <p>So far, i've seen some help on this site dealing with this in C# but I couldn't get it to work just right. Here is what i have so far. The 'newIp.text' is a text box that will allow the user to change the IP address.</p>
  
  <pre><code>Dim newAddress As String
  
      newAddress = "http://" &amp; newIP.Text &amp; "/"
  
  Dim uri As Uri = New Uri(newAddress)
      Dim address = New EndpointAddress(uri)
  </code></pre>
  
  <p>The code will return the new uri as whatever IP address i type in. However, it doesn't update the App.config file with the new settings. Any help is appreciated.</p>