I'm doing a kind of verifier, I need to press a button to check if the code of my TextBox matches in some data of the column "Code" and if so, increase by 1 the value of "Captured", this is what I'm trying now:
foreach (DataGridViewRow fila in dataGridView1.Rows)
{
if (fila.Cells[0].Value.ToString() == txtCodigo.Text)
{
int n = Convert.ToInt32(fila.Cells[3].Value);
n = n + 1;
fila.Cells[3].Value = n;
}
}
And this is the image of my table
The problem I have is that this error marks me in the execution of the program
If you could help me locate my mistake, I would be very grateful, I'm new to this, thanks in advance