Click here to Skip to main content
15,748,749 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: new in using vb and really appreciate your help..i wanted to change a status column backcolor in datagridview based on the rating column in the same datagridview.For example if the rating column="good" then status column backcolor should be green,if rating=satisfactory then status backcolor should be yellow etc. how can i do that in vb 2012?thanks a lot.
Animesh Datta 10-Apr-14 7:31am    
check the solution
Member 10738621 10-Apr-14 22:18pm    
Hi...thanks so much for your reply when i ran the code there is error message ie 'Backcolor' is not a member of 'System.Windows.Forms.DataGridViewCell'.Pls advise...thanks.

1 solution

Hello ,
You can use CellEndEdit event to fulfill your requirement . for more details on CellEndEdit follow this Link
private void dgv_CellEndEdit(object sender, DataGridViewCellEventArgs e)
     //now if rating column in 2nd position of datagridview
          if(dgv.Rows[e.RowIndex].Cells[1].Value=="good") //compare the value
             dgv.Rows[e.RowIndex].Cells[2].BackColor = Color.Green;
             dgv.Rows[e.RowIndex].Cells[2].BackColor = Color.Yellow;


Share this answer

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