I made this code but it has a problem that everytime i run it ..it overwrites my xml file and nothing new is added this is my xml file:
- <DATA>
- <Users>
<MonopolyID>User2</MonopolyID>
<Password>pass2</Password>
<FirstName>User2Name</FirstName>
<LastName>User2LastName</LastName>
</Users>
</DATA>
u can see that user1 was overwritten anyway this is my code:
public partial class SignUpPage : Form
{
private void button1_Click(object sender, EventArgs e)
{
DataSet ds = new DataSet();
DataTable dt = new DataTable();
DataColumn dc = new DataColumn("MonopolyID", typeof(string));
dt.Columns.Add(dc);
dc = new DataColumn("Password", typeof(string));
dt.Columns.Add(dc);
dc = new DataColumn("FirstName", typeof(string));
dt.Columns.Add(dc);
dc = new DataColumn("LastName", typeof(string));
dt.Columns.Add(dc);
DataRow dr = dt.NewRow();
dt.Rows.Add(textBox3.Text, textBox4.Text, textBox1.Text, textBox2.Text);//here just putting the texts in the texts box for the first row
dt.TableName = "Users";
ds.Tables.Add(dt);
ds.DataSetName = "DATA";
ds.WriteXml(@"pathOfTheFile..");
}
}