I have a datagridview which is initially bound to an empty datatable. Then the first row is populated by setting values to the columns of the grid's CurrentRow.DataBoundItem row. I enter a new row manually by typing values in the last blank row. I hit a save button which does: DataTable dt = (DataTable)MyGrid.DataSource.......
I noticed the number of rows in dt is only 1 instead of the two showing in the grid. However if I hit the Enter key first on the row and then click save, the number of rows is 3. The two filled rows plus the new row caused by the Enter key.
How do I get the two rows placed in the datatable without hitting the Enter key? (I don't want to programmatically send an Enter keystroke)
I tried to call the EndEdit() and UpdateCellValue() to accept the new row but the datasource still shows only one row.