Click here to Skip to main content
14,732,943 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
foreach (DataGridViewRow row in gvPlanning.Rows)
           {
               for (i = 1; i <= 10; i++)
               {
                   string color = row.Cells["Color"].Value.ToString();
                   if (color != "")
                   {                      
                     
                       row.Cells["Col1"].Style.BackColor =System.Drawing.Color.Red;
                       row.Cells["Col2"].Style.BackColor = System.Drawing.Color.Red; 

                   }
               }


I m using above code for set back color for particluar cells but its not working
Posted
Updated 13-Jun-13 22:12pm
v2
Comments
Surendra Adhikari SA 14-Jun-13 7:23am
   
what are you trying with this code string "color = row.Cells["Color"].Value.ToString();"
did you want to show color as value of "Color" column ?

if you have a column with name Color then it is working code.
check for values of column(Color).

1 solution

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

  Print Answers RSS
Top Experts
Last 24hrsThis month



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