"Insertat" problem
I need to insert new row into DataGrid to a specified position (not at the end of the table). I tried to use the DataTable.Rows.InsertAt() method which does (almost) exactly what I need. The 'almost' means that the row is added at the end of the table even if I specify an index for the new row.
I have already tried to search the internet and the only solution I have found was to call DataTable.AcceptChanges() method. OK, this works, the row is then realy displayed on the propper position. Problem is that when I try to change some values in that row, the row jumps at the end of the table and an empty row appears at the correct position. If I try to make any other changes into the row (which is ath the bottom now), the application crashes with following exception:
Object reference not set to an instance of an object.
at System.Data.DataRowView.System.ComponentModel.IDat aErrorInfo.get_Error()
....
....
.
how to resolve this problem?
|