I'm having some difficulties in working with DataGridViewCheckBox using a chekBox aside, almost everything is working in normality, the problem is when using the select all option, which is the chekBox that I added the part, for example: when I select two lines and then click on select all, it happens that it disables the two lines selected and enables the other lines that were not selected. p>
Here's the code:
private void chk_Selecionar_CheckedChanged(object sender, EventArgs e)
{
foreach (DataGridViewRow row in dgv_Entrada.Rows)
{
DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)row.Cells[0];
chk.Value = !(chk.Value == null ? false : (bool)chk.Value);
}
How do I, when I click select all it enables all the fields and if by chance you already have a field enabled it keeps enabled, and when you disable the select all option, it disables all fields?