1
I’m developing an application where several Usercontrols will be shown in a Panel from the code below:
UserControl1 u1 = new UserControl1();
panel1.Controls.Add(u1);
And remove them from this code:
panel1.Controls.Clear();
However, I am not able to insert this command from a button inside the Usercontrol. Only from the form where the Panel is
You need to put in a little more code. But to get the idea, you have to make the object Panel1 as public, and pass it to the Usercontrol constructor in order to access it in other objects (in this case, within userControl). Or leave this Panel1 as Static.
– Renato Afonso