How to highlight values inside a gridview in c#
  • Hello
    I have grid view in Windows form c# application, I want to highlight some column values if some condition becomes true. 
    For example
    i have a grid view with columns
    +-----+--------+---------------+-------------------+
    |  id  |  Name  |   Serial No  |   Expiry Date   |
    +------+--------+---------------+--------------------+
    | 01  |  abc   |  0001234   |  10/13/2014     |
    +----+-----------+---------------+--------------------+

    I want to highligh values of Cloumn "Expiry Date" if value is equal to current Date.

  • 2 Comments sorted by
  • just compare the current date and your date
    if(_datetime==_currenttime)
    {
    // highlight the cell value by red color
    }
  • if(_datetime==_currenttime)
    {
    for(int i=0; datagridview1.rows.count-1;i++)
    {
    dataGridView1.Rows[i].Cells[Expiry Date].Style.BackColor = Color.Red;
    }
    }

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Tagged

Popular Posts of the Week

Top Posters Weekly

Optimum Creative