forum

Home / DeveloperSection / Forums / How to do the color for a particular row in a gridview?

How to do the color for a particular row in a gridview?

Anonymous User 1871 10-Mar-2015

I am using two forms,when I am sending the StockID from one form to another form,in the second form there is some data in the gridview,now I wan to do tat is,by using that id I want to highlight the that row only. I want to compare the ID is exists in the gridview or not,if exits the I want to Do the higlighten for that full row.,



if (pc == c)

{

    for (int i = 0; i < grid_stock.Rows.Count; i++)

    {       

grid_stock.SelectionMode = DataGridViewSelectionMode.FullRowSelect;       

this.grid_stock.Rows[i].DefaultCellStyle.BackColor = Color.Red;

        break;

    }                      

}


Updated on 10-Mar-2015
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By