mardi 4 juin 2019

c# Loop through multiple bunifu checkboxes

I have a program which have multiple check boxes on a windows form. I am using Bunifu framework for the check boxes. I want to loop through all the check boxes. However, I can't seem to loop through with bunifu check boxes, it works with normal check boxes.

I have tried the following code. It works as intended with normal check boxes but not working for bunifu check boxes. The code doesn't think its a checkbox I believe.

foreach (Control ctrl in this.Controls)
            {
                if (ctrl is CheckBox)
                {
                    if(((CheckBox)ctrl).Checked == true)
                    {

                       //main code here

                    }
                }
            }

I want to be able to do same thing but with the bunifu check boxes. Is there something I am missing.

Thanks for your help.




Aucun commentaire:

Enregistrer un commentaire