Hello,
I want to add a form1 into a panel which is on form2.
private void Form2_Load(object sender, EventArgs e) {
form1 = new Form1(); form1.Dock = DockStyle.Fill; this.ultraPanel2.Controls.Add(form1);~
}
But this doesn't work. Am I doing something wrong?
Thank you.
Best regards,
Maria
Hello Angie,
Is there anything you need help with or are you just sharing your code with the community?
example: (ViewFormReport is the user control you want displyed inside the ViewFormPanelControl user control )
Dim ViewFormReport As New ViewFormReportViewFormPanel.ClientArea.Controls.Add(ViewFormReport)ViewFormReport.Show()
You also need to set TopLevel to false on form1 so it can be added as a child control.
The UltraPanel should add child controls through UltraPanel.ClientArea.Controls instead of directly off the Controls collection property of the UltraPanel.
Also don't forget to call show on the form instance after you add it to the collection.
In general it is better to use UserControls for this layout, but if you must use Forms you can achieve the desired results with the above modifications.