Re: Change Container Content
Create seperate User Controls for each of the things you want in Panel2. Then just make the 'active' one visible and hide the other(s) when the button is pressed in Panel1.
Re: Change Container Content
Quote:
Originally Posted by
rliq
Create seperate User Controls for each of the things you want in Panel2.
That's the key point. Futher, you can show/hide individual controls like sugested, or add/remove them to/from container Controls collection,
Re: Change Container Content
Thank you very much I also came up to this ideia some minutes after I aked ;) but once again what's the code to load usercontrols into for example "splitContainer1.Panel1"?? some code please if anyone can help :D thanks
Re: Change Container Content
Code is not necessarily required.
Create a UserControl in the designer and rebuild your Project. Then your control should appear in your toolbox and you can drag it onto Panel2 like any other standard windows control. Use the Dock property to make it fill the Panel.
You can even make your UserControl fire your/it's own events which you make up, like OnSwitchPanel() etc, which can be handled by it's container (like when you handle a Button's OnClick event). UserControls also help to keep your application modular and more easy to maintain, as all related code is within the UserControl and not sprawled across the your Main Form. If you create a general UserControl it can be used in many of your Projects.
If you are just learning, don't be afraid to create a 'test' project' (or lots of them, they are easy to delete afterwards), no splitter, nothing complicated, just a form with a very simple UserControl you create. Play with it until you understand how they work. Once you understand, you will more quickly implement your real control in your real app. So you take a step back to move two steps forward. That's what I do and I suspect many others here do the same when looking at something new to them. Sorry if this last paragraph was patronising... Good Luck.
Re: Change Container Content