3
I have a Form with a Dropdownlist with Checkbox inside, and I have an external Checkbox that selects and unchecks all.
My question is this:.
When I uncheck one of the items in Dropdown the "Select All" Checkbox should be unchecked and when I select all items it should be checked. But when I do the events are interacting with each other and are giving error.
Someone knows a way to do it?
This is the Checkbox code Select All.
private void cbSelAll_CheckedChanged(object sender, EventArgs e)
{
if (cbSelAll.Checked == true)
{
//Ao selecionar a flag Selecionar todos marca todos os itens
for (int i = 0; i < cb.CheckBoxItems.Count; i++)
{
cb.CheckBoxItems[i].Checked = true;
}
}
else
{
//Ao desmarcar a flag Selecionar todos desmarca todos os itens
for (int i = 0; i < cb.CheckBoxItems.Count; i++)
{
cb.CheckBoxItems[i].Checked = false;
}
}
}
As you added
checkbox
within theDropDownlist
?– MeuChapeu
Using a control called Checkboxcombobox
– Rafael Arnosti
would be this?
– MeuChapeu
Yes it would be, but the control doesn’t have much to do with the question, I managed to find the answer. I was using the Event when the checkbox was scheduled so one event influenced the other so I changed the event to click and it worked :) but thanks for the help
– Rafael Arnosti