So I have a for each loop that gets all of the checkboxes on a panel, it successfully loops through them and returns the name and checked state. However in my if statement "cb->Checked" also tried "cb->Checked == true" it doesn't seem to enter this if statement. What am I doing wrong?
int counter = 0;
for each (Control^ c in page_General->Controls)
{
if (c->GetType() == CheckBox::typeid)
{
CheckBox^ cb = static_cast<CheckBox^>(c->Parent);
MessageBox::Show("test " + counter);
if (cb->Checked)
{
MessageBox::Show("test " + counter);
generalSkill[counter].canAccess = true;
counter++;
}
}
}