I create and add a new row to an unbound DataGridView. Then, if I try and
access an item in the Cells collection of the row, as in my commented out
code, I get an index out of range exception, rowIndex. I'm not specifying a
row index, so I assume it is inferring it from the row object, whose
rowIndex property is -1. However, when I access the cell through a row in
the grids Rows collection, I'm happy, as in my other code. Can anyone
explain this behaviour?
ExportLineRow newRow = new ExportLineRow(); // Derived from
DataGridViewRow.
newRow.CreateCells(dgvLayout);
dgvLayout.Rows.Add(newRow);
int cx = 0;
foreach (Column o in newLIne.RecordLayout.Columns.Values)