{
if (control is UserControl) // This control shown into a panel I give you code bellow. (This control is pnHome bellow)
{
if (control.HasChildren)
{
foreach (Control c in control) // this statement error as above
{
//I want to clear all control under myControl (See code bellow). (TextBox, CheckBox, Label, .. .etc )
}
}
}
}
Code to show UserControl to a Panel
myControl u = new myControl();
u.Dock = DockStyle.Fill;
pnHome.Controls.Clear();
pnHome.Controls.Add(u);
I don't know why?
Please, share help me to clear the control.
Thank you very much.