Link to home
Start Free TrialLog in
Avatar of ToddHawley4984
ToddHawley4984

asked on

Displaying multiple objects in the same form

Hi,  
I'm currently have a program that consists of a form with several buttons.  Each button loads a different form with its own controls. I would like to change this.  My idea is to only have one form and to use a menustrip. Then of course when i click something in the menu strip the form will be populated with the appropriate controls.  My question:  Is it best to design all the different layouts i want in the designer and then put them in a group box for instance and enable/disable that group box as i need it?  Or should i add and delete the controls i want within the code??  And ideas opinions would be appreciated.
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

I don't see any advantage in the latter. Putting each set of controls in its own group box, and hiding all but the active one is a lot simpler.

I would only advise hiding and showing individual controls if you needed some of the controls to appear in one or more sets.
'one or more'
should have been
'more than one'
Avatar of ToddHawley4984
ToddHawley4984

ASKER

Ok thats what i wanted to do but how do you physically deal with that in the designer?  Do you just have them all side by side and then move them to the appropriate location when they load?
ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Well part of problem is that will have conrols on multiple layout but not in such a way that I can rely on a groupbox. For instance on one page I may have 5 textboxes in a groupbox. Then on another layout I may only need 3 of those textboxes. I've since decided to add all controls for a give layout to a collection and then hide or show then at once. What I don't know how to do is to place them in containers such as a groupbox or panel. I can only place it in one place in the designer and will need to move it with code if I need to use it somewhere else. Is there some object that could be used as a placeholder of sorts?  
I feel like I've made my last question difficult to follow.   To make it simpler, How do I, with code, move a textbox that is in a group box or panel to a different groupbox or panel? Unless I am missing something I will have to do this?
I'm accepting your solution because i realized a big problem with the idea i was going with and no longer need the last reply answered.  Thanks for the help..