I presume your problem here, is that you want the rest of the DataGridView to be ReadOnly? Unfortunately the two properties AllowUserToAddRows and ReadOnly are contradictory, if ReadOnly is true, then AllowUserToAddRows will indeed give a new row, but you cannot edit it.
So if you really want to do this then you need to be a little creative. There is more than one way, but something like this should work. Set AllowUserToAddRows to true and ReadOnly to false. Add a private field:
private int addedRowIndex = -1;
Next add a couple of events:
private void dataGridView1_UserAddedRow(object sender, DataGridViewRowEventArgs e)
{
addedRowIndex = dataGridView1.NewRowIndex - 1;
}
and
private void dataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
{
if (!dataGridView1.Rows[e.RowIndex].IsNewRow)
{
if (addedRowIndex != e.RowIndex)
{
e.Cancel = true;
}
}
}
}
This will have the effect of cancelling all changes to old rows.
Please note however that I never do anything like this myself. I have many, many forms with DataGridViews and they are always ReadOnly true and AllowUserToAddRows false. To add a new Record, I provide a button which opens a Modal Form allowing the user to enter the new record. This record is then saved to the database and the form closed, at which point the DataGridView gets refreshed. I find this makes it far easier to validate entries prior to saving. Not only that but it is much easier to provide specialised controls for particular data types, dates being a very good example. I know people like the convenience of a spreadsheet type "look and feel" but a database application should put data integrity first.