I have a DataGridView that is bound to a TableAdapter and filled with the Fill method when the form opens. The grid is not editable; it's for display only. One of the columns is unbound and should be populated with a value calculated from the other columns.
I thought the RowsAdded event would let me do this. But although the RowsAdded event does fire for each row, it seems to firebefore the row is populated (all the cell values are null), and for some reason, values entered into cells in this event do not display in the grid.
The CellFormatting event let me do this with the following code.
private void dgvReqSecretarial_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (e.ColumnIndex == 5)
{
e.Value = "x";
e.FormattingApplied = true;
}
}But this event fires for every single cell and not just once per row, which is pretty inefficient.
Does anyone know of an alternative?