I have a DataGridView in this way:
and this is my code
Clicking on the register button does this:
foreach (DataGridViewRow item in dgvEstudiantes.Rows)
{
int indice = dgvEstudiantes.CurrentRow.Index;
MessageBox.Show(""+indice);
DataGridViewCheckBoxCell objCheckBox = (DataGridViewCheckBoxCell)item.Cells[4];
if (objCheckBox.Value == objCheckBox.TrueValue)
{
objAsistencia.IdCurso = int.Parse(cmbAsistenciaCurso.SelectedValue.ToString());
objAsistencia.Estado = 1;
objAsistencia.HorasVistas = int.Parse(txtHorasvistas.Text);
objAsistencia.Fecha = dtpFechaAsistencia.Value.Year + "-" + dtpFechaAsistencia.Value.Month + "-" + dtpFechaAsistencia.Value.Day;
objAsistencia.registrarAsistencia();
MessageBox.Show("Sirve boton");
}
else {
MessageBox.Show("no sirve boton");
}
}
But the problem that I present is that the index always shows this
therefore the record of document 122222 never does. Could you help me start at 122222?