Panels design

G

Guest

I have following situation:
On the righthand side of the form i have navbar and panel to the right.
Content of the panel is supposed to be different according to what user
chooses in the navbar.
How to do that at the moment of design.
How am I creating another panel with different content at the same place as
the previous one , what do I do with the previous content. Hide it??
I know that later i use the visibility option to dispay certain panels.
But how to acreate all of them at the same place in the designer??
 
C

Chris Dunaway

One option would be to only have one content panel. Create each "page"
as a separate UserControl and place the rest of the content on the
Usercontrol. Then, in response to the selection on the navbar,
instantiate and display the appropriate control and place it on the
panel.

You could also use Forms for this by setting the form's BorderStyle to
nothing and it TopLevel property to False. Then set the Form's Parent
property to the Panel and Show the form and it will appear inside the
panel.
 
M

Mick Doherty

If you're using VS2003 (will probably work in VS2002 but I don't have a copy
to test it) then see the PanelManager Class on my site which was created
specifically for this:
http://www.dotnetrix.co.uk/custom.html

In VS2005 the class still works, but because of DesignTime Designer issues
(which MS are currently working on) the control needs to be built in a
seperate ControlLibrary solution and the control referenced via the created
dll. If the control is included as part of the solution, even if it's in a
seperate project, then the Panels Collection works Ok in the designer until
the project is rebuilt, at which time if you try to access the panels
collection you get an invalid cast exception due to the designer referencing
the pre build collection items instead of the current build items.

An alternative method, as Chris suggested, is to use UserControls and load
them dynamically at runtime.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top