DataGrid add new row into DataSet fails -
09-02-2004
, 05:42 PM
Greetings,
I having a problem using a DataGrid and a DataSet to create a very simple
xml editor.
Everything works great except inserting a new row using the DataGrid GUI.
I set myDataGrid.DataSource = myDataSet and call myDataSet.ReadXml(
myXmlFile.xml );
Reading the xml file (above) creates one table in myDataSet.
The table displays great in myDataGrid and I can edit the data displayed
and save it by calling
myDataSet.WriteXml( myXmlFile.xml ). WriteXml is called for the following
events:
myDataSet.Tables[0].RowChanged
myDataSet.Tables[0].RowDeleted
myDataSet.Tables[0].ColumnChanged
Problem:
I can not get myDataGrid to insert successfully.
myDataGrid shows a blank line (last row of data) so I can click and add a
new row of data.
When I enter a new row of data, WriteXml is called but the new row of data
is not written to the xml file.
(I do not see it in the DataSet).
However, if I enter another (second) row (below the first) the first row of
data is written to the xml.
Maybe someone has a suggestions?
Thank you,
Tom |