Reputation: 19097
Here is the XML file:
<Test>
<Code Layer='V' Colour='1'/>
<Code Layer='W' Colour='1'/>
<Code Layer='WE' Colour='1'/>
</Test>
My Form
(WinForm) has a DataGridView
on it and I have bound the view to my XML file:
private void GENIO_Code_Editor_Load(object sender, EventArgs e)
{
DataSet dataSet = new DataSet();
dataSet.ReadXml("d:\\MyFile.xml");
dataGridView.DataSource = dataSet.Tables[0];
}
It works (note that example has more codes in the XML file):
My problem is that, if I type in new values at the bottom (asterix row) these new additions are not getting updated in the XML file.
What step am I missing? Thank you.
Upvotes: 1
Views: 276
Reputation: 11773
The values in the dataset are not saved automatically. To save the dataset use the .WriteXml method.
dataSet.WriteXml("d:\\MyFile.xml");
Upvotes: 1