I must print each of the elements that I bring to a GRID but it generates that error when entering the cycle if I put it in in try to print them but the program does not close it is executed in the background and I must close it killing the process
private void button2_Click_1(object sender, EventArgs e)
{
r = new imprimirmanifiesto();
int pos = 0;
bool a = true;
while (a == true)
{
// EL ERROR SALE EN ESTA LINEA
if (string.IsNullOrEmpty(dataGridView1.Rows[pos].Cells[0].Value.ToString()))
///----
{
a = false;
}
else
{
a = true;
}
r.imprimir(dataGridView1.Rows[pos].Cells[1].Value.ToString());
pos++;
}
}