title: Writing My.Settings to Text File
body: <p>OK, so I am having some trouble with writing to a text file, retrieving values from My.Settings. The code is below. The problem is that when I check the text file, it only has the first line (which is just a simple string in the code).</p>
  
  <pre><code>Dim settingsfile As String = Directory.GetCurrentDirectory &amp; "\RapidSend_Settings.txt"
  Dim objWriter As New System.IO.StreamWriter(settingsfile, False)
  objWriter.WriteLine("This is the introductory line")
  For Each strEmail As String In My.Settings.User_Emails 'Specialized.StringCollection
      objWriter.WriteLine("Email " &amp; strEmail)
  Next
  For Each strHostName As String In My.Settings.User_HostName ' Specialized.StringCollection
      objWriter.WriteLine("Host " &amp; strHostName)
  Next
  objWriter.WriteLine("End Of File")
  objWriter.Close()
  </code></pre>
  
  <p>This is what the text file looks like after the code:</p>
  
  <pre><code> This is the introductory line
   End Of File
  </code></pre>
  
  <p>My question is does anyone know what the problem is, or is there another way to do this.
  BTW, all the My.Settings are Specialized.StringCollection, so they contain lots of strings.</p>