I am using a SplitContainer to split a MDI form vertically. On the left panel I have a tree control and on the right panel I am displaying the child forms. I am trying to ensure only a single instance of a child form is open at any time. To do that I am checking the MdiChildren count. However, the mdi children count is resetting to zero after I add the child form to the right panel of the split container.
subjectForm.MdiParent = this;
Console.WriteLine("B => " + this.MdiChildren.Length);
this.splitContainer1.Panel2.Controls.Add(subjectForm);
Console.WriteLine("A => " + this.MdiChildren.Length);
In the above code sample, this is the response I am getting
B => 1; A => 0
Any idea where I am going wrong ?
After spending long hours trying to work with the SplitContainer, I replaced it with a splitter and things are working as expected. However, I am still not sure about the utility or need for the split container control.