I am generating dynamically Chechbox-buttons on a panel according to my SQL data.I created a button to "refresh" my buttons, I mean I delete / update buttons . My problem is i cannot delete the old buttons. After a created the buttons I am trying to delete a specific one:
foreach (CheckBox item in panel.Controls.OfType<CheckBox>())
{
if (item.Name == "something")
{
panel.Controls.Remove(item);
}
}
There are only few deleted . Any suggestion...
Aucun commentaire:
Enregistrer un commentaire