c# windows form application in the same dataGridView compare the two columns which column value is high then disply the message box
c# datagridview
Collapse
X
-
Hi rajapavan,
Try like this code, I guess this code is helpfull for u.
Code:int Value1=0, Value2=0; for (int row = 0; row < dataGridView1.Rows.Count; ++row) { Value1 = int.Parse(dataGridView1.Rows[row].Cells["Column1"].Value.ToString()); Value2 = int.Parse(dataGridView1.Rows[row].Cells["Column2"].Value.ToString()); if(Value1 > Value2) MessageBox.Show("Largest value is " + Value1); else MessageBox.Show("Largest value is " + Value2); }
Comment