I want to reduce the probability of users editing the wrong record so once they start editing one row in datagridview i want to hide all rows.
I tried this:
foreach (DataGridViewRow dgvr in rdGridView.Rows)
{
if (dgvr.Index != e.RowIndex )
{
dgvr.DefaultCellStyle.BackColor = Color.DarkGray;
dgvr.ReadOnly = true
}
}
But this doesn’t give much of a protection.
I can update the DataView to only show that row and assign the dataview again to the datgridview but that would take the focus out of the cell, and cell doesn’t go into edit mode.
Doing dgvr.Visible = false in a foreach loop like above also gives exception
Couldn’t find anything better than making all the rows read only and turning them gray except the one being edited.