T
Tomas R
I have a datagrid with a dataview(created from a DataTable) bind to it. It displayes coordinates and I have a toolbarbutton that will create a set of new coordinates just like the existing ones, accept that the x-values is mirrored. It's also possible to remove these coordinates, by a method that removes any row with negative x-values. This usually works fine a few times, mirroring and then removing. But then suddenly the NewRow statement returns the same object as the last one in my DataRowCollection!?! I've put traces just before and after the NewRow statement, and the last DataRow in the DataTables DataRowCollection is cleared and sat the the same object as the onw returned from newRow!?! THAT my friends seem to me like a BUG!
I've also put traces to see what the DataView(comming from the datagrid) contains, and just after the NewRow statement the last DataRowView becomes DETACHED!?!
int start = noOfCoordinates - 1;
DataRow newRow;
for( int i = start; i >= 0; i-- )
{
newRow = myDataTable.NewRow();
newRow.ItemArray = new object[] {
Guid.NewGuid(),
NextSequenseNumber(),
++noOfCoordinates,
-1 * coords[0],
coords[1] };
myDataTable.Rows.Add( newRow );
myDataTable.AcceptChanges();
}
Any ideas folks? Cause I'm really frustrated know...
Kind regards/
Tomas R
I've also put traces to see what the DataView(comming from the datagrid) contains, and just after the NewRow statement the last DataRowView becomes DETACHED!?!
int start = noOfCoordinates - 1;
DataRow newRow;
for( int i = start; i >= 0; i-- )
{
newRow = myDataTable.NewRow();
newRow.ItemArray = new object[] {
Guid.NewGuid(),
NextSequenseNumber(),
++noOfCoordinates,
-1 * coords[0],
coords[1] };
myDataTable.Rows.Add( newRow );
myDataTable.AcceptChanges();
}
Any ideas folks? Cause I'm really frustrated know...
Kind regards/
Tomas R