Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I have made an application sale tracker in which,I will see the which customer is appointment to which company an have show the particular row in datagridview highlighted.
Posted

see here[^] a great example
 
Share this answer
 
Comments
Prasad_Kulkarni 15-Mar-12 9:33am    
Good link +5
You can use the OnRowCreated event to set the backcolor of a row.
 
Share this answer
 
You can try this

SQL
if (Datagridview.CurrentRow.Cells["The Name of the Datagridview Heading"].Value.ToString() == "Specefic value in the cell that are under the Datagridview heading")
{
this.Datagridview.DefaultCellStyle.SelectionBackColor = Color.Green;
this.Datagridview.RowHeadersDefaultCellStyle.SelectionBackColor = Color.Green;
}



Example

Datagridview layout

ID            CustomerName          CustomerSurname
1             Peter                Boschoff

SQL
if (Datagridview.CurrentRow.Cells["CustomerName"].Value.ToString() == "Peter")
{
this.Datagridview.DefaultCellStyle.SelectionBackColor = Color.Green;
this.Datagridview.RowHeadersDefaultCellStyle.SelectionBackColor = Color.Green;
}
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900