Red - if the priority of this row is highGreen - if the priority of this row is Medium
Example: if I have 10rows, (4 of them the priorirty is high and 2 of them the priority is medium)So>> I have the following: 4rows the fontColor is Red, 2Rows the fontclor is green, the rest is default.
this is the code that I am trying to use, but if fails:
private void changeColor() {
foreach (DataGridViewRow row in dataGridView1.Rows) {
//priority = row.Cells["Priority"].Value.ToString(); switch (priority) { //Change font case "High": row.DefaultCellStyle.ForeColor = System.Drawing.Color.Red; break; case "Medium": row.DefaultCellStyle.ForeColor = System.Drawing.Color.Green; break; case "Low": row.DefaultCellStyle.ForeColor = System.Drawing.Color.Black; break; default: row.DefaultCellStyle.ForeColor = System.Drawing.Color.Black; break; } }