1 | initial version |
To display multiple forms within a single panel in C# .NET4.8.1 using Visual Studio 2022, you can follow these steps:
private void ShowUserControl(UserControl userControl)
{
panel1.Controls.Clear();
panel1.Controls.Add(userControl);
}
private void button1_Click(object sender, EventArgs e)
{
var userControl1 = new UserControl1(); // Replace UserControl1 with the name of your UserControl
ShowUserControl(userControl1);
}
Note: The above steps show how to display UserControls within a Panel control on a form. To display multiple forms within a Panel control, you can follow a similar approach, but instead of UserControls, you would create instances of your forms and set their TopLevel and FormBorderStyle properties to false before adding them to the Panel control.