13
Answers

Role through a datagridview - set readonly as datagridview gets populated

ic ic

ic ic

15y
8k
1

Hi,
I want to display certain rows readonly & change back color of a datagridview & displayed as the grid gets populated
The problem i have is that I'm using the RowEnter Event - which works when the user selects a row
But i whant it to be displayed on the grid visually without selecting a row - when grid gets populated:
private void dgvDetail_RowEnter(object sender, DataGridViewCellEventArgs e)
{
dgvCurrentRow = dgvDetail.Rows[e.RowIndex];
if (oLOTXLOCXID_Row["WhsLPNo"].ToString() == "Found")
{dgvCurrentRow.DefaultCellStyle.BackColor =
this.BackColor;
dgvCurrentRow.DefaultCellStyle.ForeColor =
SystemColors.GrayText;
dgvCurrentRow.ReadOnly = true
dgvCurrentRow.Cells[10].Value = 1;}}
Please Help!
Answers (13)