private void btnAddCategory_Click(object sender, EventArgs e) { try { string patentCategoryText = cmbParent.Text.Trim(); string foodTypeText = cmbFoodType.Text.Trim(); AddCategoryCtl objAddCat = new AddCategoryCtl(patentCategoryText, foodTypeText); objAddCat.Parent = this.ParentForm; UserControlManager.UserControls.Push(this); Panel pnl = (Panel)this.ParentForm.Controls["pnlContext"]; string s = pnl.Name; objAddCat.ParentForm.Controls[s].Controls.Clear(); objAddCat.ParentForm.Controls[s].Controls.Add(objAddCat); } catch (Exception exp) { throw exp; } }