Try something like:
Panel pan = (Panel)this.tabPage1.Controls.Find("a" + i.ToString(), true)[0];
CheckBox ck = (CheckBox)this.tabPage1.Controls.Find("check" + i.ToString(), true)[0];
Of course you should also check if the control you're looking for exists at all and is indeed a checkbox or panel:
Control[] panels = this.tabPage1.Controls.Find("a" + i.ToString(), true);
Panel pan = null;
CheckBox ck = null;
if (panels.Length > 0 && panels[0] is Panel)
{
pan = (Panel)panels[0];
}
else
{
}
Control[] checkBoxes = this.tabPage1.Controls.Find("check" + i.ToString(), true);
if (checkBoxes.Length > 0 && checkBoxes[0] is CheckBox)
{
ck = (CheckBox)checkBoxes[0];
}
else