1
I’m having a hard time working with Datagridviewcheckbox using a chekBox apart, almost everything is working in normality, the problem is when using the option to select everything, which is the chekBox that I added the part, for example: when I select two lines and then click on select everything, it turns out that it disables the two lines selected and enables the other lines that were not selected.
Here is 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, so that when I click select everything it enables all fields and if by chance you already have a field enabled it keeps enabled, and when disable the select all option, it disables all fields?
'chk. Value = true;' will leave all fields enabled. This code is used to disable as well?
– Leo Longhi
Yeah, that’s right, that’s right
– António Mateta