c# - How to change row color in datagridview? -


I want to change the color of a particular line in my datagrid view. If the value of column 7 is less than the value in column 10, then the row should be changed to red. Any suggestions about how to accomplish this?

You need a loop through rows in the DataGrade view and then columns 7 and 10 in each row Compare prices.

Try it:

  foreach (DataGridViewRow Line Vendors in DataGridView.Rows) if (Convert.ToInt32 (line Seals [7]. Value) Convert ToInt32 (line.cel [10]. Value)) {row.DefaultCellStyle.BackColor = Color .Red; }  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -