Compare cells in 2 datagridviews

Mar 28 2018 4:26 AM
Hi guys, 
 
I have 2 datagridviews(dgv1 & dgv2) populated with rows with the same columns. 
 
I want to have the row from dgv2 cycle through dgv1 and if a cell is more than that of the row in dgv2 I want to color the background of the cell to mark that it exceeded.  
 
I did get it to work by using foreach and while, but it takes sooooo long to process. Any way I can compare cells that might be quicker. Because atm isong once cell at a time scrolling through all 100 dgv1 rows and then moving to the next cell is taking a long time and I'm sure im beign inneficient. 
  1. while (currentCell < (colCount + 1))  
  2. {  
  3.   
  4.     foreach (DataGridViewRow rTestData in dgvSampleTestData.Rows)  
  5.     {  
  6.        //Test and chenge backgroun color  
  7.     }  
  8.     currentCell++;  
  9. }  

Answers (1)