Reputation: 49
i try to highlight the selected row become red where column is 'E' in datagridview but if the first row's status is 'E',the following row also become red too although status is 'I'.
SelectionChanged event
int sel = datagridview.SelectedCells[0].RowIndex;
DataGridViewRow Row = dataGridView.Rows[sel];
if(!File.Exists(path))
{
Row.Cells[4].Value = "E"
for(int i=0;i<5;i++)
{
Row.Cells[i].Style.BackColor = Color.Red;
}
}
Upvotes: 0
Views: 289
Reputation: 49
Just use the dataGridView_CurrentCellChanged event can solve this problem.
Upvotes: 1