Sunday 3 August 2014

DataGrid Row Background Color change programmatically


Posted on: 04 Apr 2014  
you see this.

    private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
    foreach (DataGridViewRow Myrow in dataGridView1.Rows) 
    {            //Here 2 cell is target value and 1 cell is Volume
        if (Convert.ToInt32(Myrow .Cells[2].Value)<Convert.ToInt32(Myrow .Cells[1].Value))// Or your condition 
        {
            Myrow .DefaultCellStyle.BackColor = Color.Red; 
        }
        else
        {
            Myrow .DefaultCellStyle.BackColor = Color.Green; 
        }
    }
}

1 comment:

  1. Mission-It : Online Software Training Program: Datagrid Row Background Color Change Programmatically >>>>> Download Now

    >>>>> Download Full

    Mission-It : Online Software Training Program: Datagrid Row Background Color Change Programmatically >>>>> Download LINK

    >>>>> Download Now

    Mission-It : Online Software Training Program: Datagrid Row Background Color Change Programmatically >>>>> Download Full

    >>>>> Download LINK iU

    ReplyDelete