Parent-child forms

Jul 17 2009 8:06 AM
I am trying to call a user control from the selection of a box list in my main form. The user control appears but it's in the back of my main form... Here is my code ... #region UserControls private void DisplayUserControls() { strType = listBoxVersion.SelectedItem.ToString(); switch (strType) { case "Import File": ctlImportFile_Load(); break; case "Table": ctlControl1_Load(); break; } } private void ctlControl1_Load() { Seph.WinApp.UserControls.ctlControl1 c = new Seph.WinApp.UserControls.ctlControl1(); c.Visible = true; c.BringToFront(); this.Controls.Add(c); } private void ctlImportFile_Load() { Seph.WinApp.UserControls.ctlImportFile a = new Seph.WinApp.UserControls.ctlImportFile(); a.Visible = true; a.BringToFront(); this.Controls.Add(a); } private void ctlClear_Load() { Seph.WinApp.UserControls.ctlClear b = new Seph.WinApp.UserControls.ctlClear(); b.Visible = true; b.BringToFront(); this.Controls.Add(b); } #endregion public partial class ctlImportFile : UserControl { public ctlImportFile() { InitializeComponent(); } public void SetType(){ m_strType = strType; } } I think I am missing the part to assign the parent and the child form... It looks like something like this in VB: In main: Private m_frmParentForm As Main In userControl: Public Class ctlControl1 #Region " Variables Declaration Section " Private m_frmParentForm As frmEquipmentTracking I did added this in my main but nothing works: public SephMainForm { get; set; } I am not very experimented.... I think I am lost! Is there a way that I can add a screenshot?? Maybe it would be easier to show you guys what I am talking about... Thanks a lot for your help...