I am trying to update the value of a checkbox column in datagridview in c# by code but it is not working. Here it is the code:
public frmShowData()
{
InitializeComponent();
dgvAlumnos.AutoGenerateColumns = false;
dgvAlumnos.ReadOnly = false;
updateAttendance();
}
public void updateAttendace(){
foreach (DataGridViewRow r in dgvAlumnos.Rows)
{
if (attendance[r.Index] == true)
{
r.Cells[2].Value = true;
}
else
{
r.Cells[2].Value = false;
}
}
}
Attendance is the array of booleans where I have the values.
The column number 2 of the datagridview is the checkbox column.
However, the changes are not visible in the datagriview. I am using this code inside the form construct.
Thanks in advance.