title: Writing XML to a file without overwriting previous data
body: <p>I currently have a C# program that writes data to an XML file in using the .NET Framework. </p>
  
  <pre><code>if (textBox1.Text!="" &amp;&amp; textBox2.Text != "")
  {
      XmlTextWriter Writer = new XmlTextWriter(textXMLFile.Text, null);
      Writer.WriteStartDocument();
      Writer.WriteStartElement("contact");
      Writer.WriteStartElement("firstName");
      Writer.WriteString(textBox1.Text);
      Writer.WriteEndElement();
  
      Writer.WriteEndElement();
      Writer.WriteEndDocument();
      Writer.Close();
  }
  else
  {
      MessageBox.Show("Nope, fill that textfield!");
  }
  </code></pre>
  
  <p>The problem is that my XML file gets overwritten every time I try to save something new. </p>
  
  <p>I've had both <code>null</code> and <code>Encoding.UTF8</code> for the second parameter in the <code>XmlTextWriter</code> but it doesn't seem to be what changes the non-overwrite/overwrite function. </p>