ralphreindeer
New Member
I am creating a sample login form in c# windows form & I am trying to save my login username or password in a XML file but when i submit username or password it replace previous entry and don't takes a new place for new entry.What i want is that when i submit username or password it should take new place in the same XML file or don't replace previous entry.Like:-`\[code\]<Table> <Entry> <Username>[email protected]</User> <Password>*********</Password> </Entry> </Table>``<Table> <Entry> <Username>[email protected]</User> <Password>*********</Password> </Entry> </Table>`\[/code\]But its replacing the first enty every time and not giving the space for second entryPlease give me solution for this This is my code:\[code\]private void button1_Click(object sender, EventArgs e){XmlTextWriter writer = new XmlTextWriter("entry.xml", System.Text.Encoding.UTF8); writer.WriteStartDocument(true); writer.Formatting = Formatting.Indented; writer.Indentation = 2; writer.WriteStartElement("Table"); createNode(textBox1.Text, textBox2.Text, writer); writer.WriteEndElement(); writer.WriteEndDocument(); writer.Close(); MessageBox.Show("XML File created ! ");\[/code\]}\[code\]private void createNode(string pName, string pPass, XmlTextWriter writer){ writer.WriteStartElement("Entry"); writer.WriteStartElement("User"); writer.WriteString(pName); writer.WriteEndElement(); writer.WriteStartElement("Password"); writer.WriteString(pPass); writer.WriteEndElement(); writer.WriteEndElement();}\[/code\]