ic ic

ic ic

  • NA
  • 85
  • 0

Role through a datagridview - set readonly as datagridview gets populated

Oct 1 2009 3:03 AM

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)