It is required to go through the DataGridView and find there certain data entered from the textbox. How to implement it?
I tried it, it turned out but the error "The link to the object does not indicate an instance of the object." Crashes on the line in if.
for (int i = 0; i < dataGridView1.RowCount; i++) { if (dataGridView1.Rows[i].Cells[0].Value.ToString() == textBox1.Text.ToString() && dataGridView1.Rows[i].Cells[1].Value.ToString() == textBox2.Text.ToString()) { MessageBox.Show("Здарова"); } }
Value(write if I am right or wrong). - default localenullwhen an error occurs in debug mode. There you will see what kind of cell it is and what is wrong with it. - default locale