There are two dataGridView 7 and 8 on the form.
In 7, data from excel is loaded as a table, in 8, the database is loaded from the server, and you need to go through a cycle of searching and finding the names from dgv7 to dgv8. If found, then dyes in dgv7 with a green color the cell itself with a match. it turned out to make only one cycle, which will run through and search for a rigid reference to the word. I tried it like this, it did not work out. As I understand it, you need two cycles, but how to make them?
for (int i = 0; i < dataGridView7.RowCount; i++) { if (Convert.ToBoolean(dataGridView7.Rows[i].Cells[1].Value.ToString() == dataGridView8.CurrentRow.Cells[0].Value.ToString())) { dataGridView7.Rows[i].Cells[1].Style.BackColor = Color.Green; } }
Convert.ToBoolean? Do your comparisons return something else? (2) WhyToStringbefore comparison? Well this is not PHP. (3) Why is the comparison at the UI code level? You should not work with strings, but with intelligent typed entities. - VladD