forum

Home / DeveloperSection / Forums / Compare datagrid rows with each other

Compare datagrid rows with each other

Demir ACAR 2414 22-May-2014
if my grid has a this value

Number    
90            
90            

or 

Number    
90            
80           


this code is working .

 for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)            {
                for (int ii = i + 1; ii < dataGridView1.Rows.Count; ii++)
               
                    {
                        if (dataGridView1.Rows[i].Cells[0].Value.ToString() == dataGridView1.Rows[ii].Cells[0].Value.ToString())
                        {
                            MessageBox.Show("Test");
                        }

                        else
                        {
                            MessageBox.Show("mest");
                        }
                    }
}
}
if my grid has a this value ;
Number    
90            
80  
70
80
90
80

above code in looped and not working .   

c#c# 
Updated on 27-May-2014

Can you answer this question?


Answer

4 Answers

Liked By