Hi I want to save and load data from a datagridview to a xml. My idea is that I can save my datagridview to a xml how this -> \"[date]_[name].xml\" and later I can load this dat
This is the sample xml file which I have used for testing your scenario:
<dataset>
<student>
<name>Tarasov</name>
</student>
</dataset>
The sample code snippet which could access the above mentioned XML file:
private void Load()
{
string path = @"C:\dataset.xml";
DataSet ds = new DataSet();
ds.ReadXml(path);
InputDataGrid.DataSource = ds;
InputDataGrid.DataMember = "student";
}
private void Save()
{
string path = @"C:\dataset.xml";
DataSet ds = (DataSet) InputDataGrid.DataSource;
ds.WriteXml(path);
}
--SJ