Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

New row not committed in DataGridView

$
0
0
Hi.

I have a DataGridView which is bound to a DataTable:
myDataGridView.DataSource = myDataTable;

The user does the following:
  • He creates new row by clicking on the last row of the DataGridView ("*").
  • He fills in the cells of this new row.
  • He navigates to other rows with the mouse or the arrow-keys.
  • He saves myDataTable. Result: The new line is lost.
If he does the same and clicks on one RowHeader (it doesn't matter, which) before saving, then the new row is saved!

I tried to call myDataGridView.EndEdit() before saving, but without any effect.

So how can I make the DataGridView commit the value to the DataTable immediately after it has been created? And why this is not happing automatically?



Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>