I want to be able to copy the values from the previous row to the new row as a user enters it by doing something like this in my DGV’s DefaultValuesNeeded() event:
private void dataGridViewPlatypi_DefaultValuesNeeded(object sender, DataGridViewRowEventArgs args)
{
dataGridViewRow dgvr = args.PreviousRow;
args.Row.Cells[1].Value = dgvr.Cells[1].Value;
args.Row.Cells[2].Value = dgvr.Cells[2].Value;
args.Row.Cells[3].Value = dgvr.Cells[3].Value;
args.Row.Cells[4].Value = dgvr.Cells[4].Value;;
args.Row.Cells[5].Value = dgvr.Cells[5].Value;
}
…however, I don’t know if it’s possible to programmatically deduce the previous row (there is no “PreviousRow” property of args as I wishfully thinking show above).
This doesn’t exactly answer my question as posed, because it only copies one cell at a time, rather than the entire row, but it really suits my purposes (copy from the cell to the left in the first row, and from the cell above thereafter):
This works: