Hi I've written this code to search for cardserial in a gridview. But I get an error :
"Object reference not set to an instance of an object."
foreach (DataGridViewRow row in dataGridView2.Rows)
{
if (row.Cells["CardSerial"].Value.ToString().Equals(textBox2.Text))
{
dataGridView2.Rows[row.Index].DefaultCellStyle.BackColor = Color.Yellow;
}
}
Could you tell me what's the problem?