Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void CheckChanges(DataGridView view0, DataGridView view1)
- {
- if (view0.RowCount < 1 || view1.RowCount < 1)
- throw new Exception("Файлы должны быть не пусты");
- var max = view0.RowCount > view1.RowCount ? view0.RowCount : view1.RowCount;
- for (int i = 0; i < max; i++)
- CompareCells(view0.Rows[i], view1.Rows[i]);
- }
- private void CompareCells(DataGridViewRow row0, DataGridViewRow row1)
- {
- if (row0.Cells.Count < 1 || row1.Cells.Count < 1)
- throw new Exception("Файлы должны быть не пусты");
- var max = row0.Cells.Count > row1.Cells.Count ? row0.Cells.Count : row1.Cells.Count;
- for (int i =0;i<max; i++)
- {
- var cell0 = row0.Cells[i];
- var cell1 = row1.Cells[i];
- cell1.Style.BackColor = (string)cell0.Value != (string)cell1.Value ? Color.Red : Color.White;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement