How to highlight the particular row in Datagrid?
-
I am using Datagrid in my application. And at the same time i want to highlight particular row in datagrid. Using graphics class i tried to draw a rectangle on the row but drawn rectangle is invisible. In formload, datagrid is there. And in application depending upon the event rectangle should be drawn on the datagrid on particular row. Please assist me in this.
-
I am using Datagrid in my application. And at the same time i want to highlight particular row in datagrid. Using graphics class i tried to draw a rectangle on the row but drawn rectangle is invisible. In formload, datagrid is there. And in application depending upon the event rectangle should be drawn on the datagrid on particular row. Please assist me in this.
-
I am using Datagrid in my application. And at the same time i want to highlight particular row in datagrid. Using graphics class i tried to draw a rectangle on the row but drawn rectangle is invisible. In formload, datagrid is there. And in application depending upon the event rectangle should be drawn on the datagrid on particular row. Please assist me in this.
foreach (DataGridViewRow row in dataGridView.Rows) { row.DefaultCellStyle.BackColor = Color.Tomato; }
You can add if statements within the foreach to change row colors according to conditions like soforeach (DataGridViewRow row in dataGridView.Rows) { if (row.Cells[13].Value.ToString() == "someValue") { row.DefaultCellStyle.BackColor = Color.Tomato; } else if(row.Cells[13].Value.ToString() == "someOtherValue") { row.DefaultCellStyle.BackColor = Color.Blue; } }
hope it helpsHarvey Saayman - South Africa Junior Developer .Net, C#, SQL
you.suck = (you.passion != Programming)
-
foreach (DataGridViewRow row in dataGridView.Rows) { row.DefaultCellStyle.BackColor = Color.Tomato; }
You can add if statements within the foreach to change row colors according to conditions like soforeach (DataGridViewRow row in dataGridView.Rows) { if (row.Cells[13].Value.ToString() == "someValue") { row.DefaultCellStyle.BackColor = Color.Tomato; } else if(row.Cells[13].Value.ToString() == "someOtherValue") { row.DefaultCellStyle.BackColor = Color.Blue; } }
hope it helpsHarvey Saayman - South Africa Junior Developer .Net, C#, SQL
you.suck = (you.passion != Programming)
-
foreach (DataGridViewRow row in dataGridView.Rows) { row.DefaultCellStyle.BackColor = Color.Tomato; }
You can add if statements within the foreach to change row colors according to conditions like soforeach (DataGridViewRow row in dataGridView.Rows) { if (row.Cells[13].Value.ToString() == "someValue") { row.DefaultCellStyle.BackColor = Color.Tomato; } else if(row.Cells[13].Value.ToString() == "someOtherValue") { row.DefaultCellStyle.BackColor = Color.Blue; } }
hope it helpsHarvey Saayman - South Africa Junior Developer .Net, C#, SQL
you.suck = (you.passion != Programming)
glad to have helped
Harvey Saayman - South Africa Junior Developer .Net, C#, SQL
you.suck = (you.passion != Programming)