I have a form with a split container. On the left panel there are buttons where I click to show the user control on the right panel.
I would like to create a method to assign in each button to add the user control to left panel. I tried the following code but it doesn't work.
Could you help me?
private void addUserControls (UserControl uc)
{
splitContainer1 .Panel2.Control s.Clear();
uc = new UserControl();
splitContainer1 .Panel2.Control s.Add((UserCont rol)uc);
uc.Dock = DockStyle.Fill;
}
private void btnInfo_Click(o bject sender, EventArgs e)
{
addUserControls (frmCargo);
}
I would like to create a method to assign in each button to add the user control to left panel. I tried the following code but it doesn't work.
Could you help me?
private void addUserControls (UserControl uc)
{
splitContainer1 .Panel2.Control s.Clear();
uc = new UserControl();
splitContainer1 .Panel2.Control s.Add((UserCont rol)uc);
uc.Dock = DockStyle.Fill;
}
private void btnInfo_Click(o bject sender, EventArgs e)
{
addUserControls (frmCargo);
}
Comment