I found other easy way to add rows.
I use the INSERT keyb to insert a new row on my DataGridView, but you can use this code into a button for example.
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (MyDataGrid.Focused && keyData == Keys.Insert)
{
int row = MyDataGrid.CurrentRow.Index;
int myRows = MyDataGrid.Rows.Count - 1;
if (row == myRows)
{
this.insert = true;
switch (MyDataGrid.CurrentCell.OwningColumn.Name.ToLower())
{
case "NumericColumn":
SendKeys.Send("0");
break;
default:
SendKeys.Send(" ");
break;
}
}
else this.insert = false;
}
return base.ProcessCmdKey(ref msg, keyData);
}
Whis this action simulate the user press a space on teh last rows, so the grid trigger the event
UserAddedRow. For me this is the easy way to add a new row, on my project.
Happy coding