private void BtnReturn_Click(object sender, EventArgs e) { foreach (Control item in mainForm.Instance.PnlContainer.Controls) { if (item.Name == "confirmStandsModal") { mainForm.Instance.PnlContainer.Controls.Remove(item); item.Dispose(); // Release all the resources used by the control break; } } foreach (Control item in mainForm.Instance.PnlContainer.Controls) { if (item.Name == "m2lStands") { mainForm.Instance.PnlContainer.Controls.Remove(item); item.Dispose(); // Release all the resources used by the control break; } } m2lStands ucStands = new m2lStands(); ucStands.Dock = DockStyle.Fill; mainForm.Instance.PnlContainer.Controls.Add(ucStands); mainForm.Instance.PnlContainer.Controls["m2lStands"].BringToFront(); }
private void MainForm_Load(object sender, EventArgs e) { _obj = this; m2lStands ucStands = new m2lStands(); m2lParticipants ucParticipants = new m2lParticipants(); m2lHotel ucHotel = new m2lHotel(); m2lAteliers ucAtelier = new m2lAteliers(); ucStands.Dock = DockStyle.Fill; ucParticipants.Dock = DockStyle.Fill; ucHotel.Dock = DockStyle.Fill; ucAtelier.Dock = DockStyle.Fill; panelContainer.Controls.Add(ucStands); panelContainer.Controls.Add(ucParticipants); panelContainer.Controls.Add(ucHotel); panelContainer.Controls.Add(ucAtelier); }