Question displaying different groups of information?

QMIMike

New member
Joined
Jan 12, 2009
Messages
3
Programming Experience
3-5
I spend the last five years performing web programming and I am now being asked to create a very small Windows Form application. I am used to having different pages and then moving between the different pages. I have what I would consider to be 4 different pages in a typical web application. What is the recommended method of displaying different groups of information within a windows form based application. I have read that some people

1. Embed forms into forms.
2. Use the UserControls.

I tried the UserControls, but I couldn't get it to work like I wanted. Any suggestions or references would be appreciated. Thanks, Mike
 
Hello.

Depends how you wanna display them. If they're are one and the same information group then I'd suggest using a Tab-Control. If they're 1 page for main information and the other 3 are further informations I'd suggest TabControl or different forms.

Of course you'd also use a button to switch between the infromations, have the controls for each in a different panel (within a StackLayoutPanel) and setting the Visible Property to True for one, and for the rest to false.

Bobby
 
Of course you'd also use a button to switch between the infromations, have the controls for each in a different panel (within a StackLayoutPanel) and setting the Visible Property to True for one, and for the rest to false.

Bobby

Thanks for the quick reply. I like the sound of this option as I already have my menu setup so I would be using buttons. I did an object search for StackLayoutPanel and couldn't find anything. After a Google search, I saw this is a WPF control. I'm not ready to go down that road yet. Is there a way to do this within just Windows Forms?
 
Have a look in the "Containers" section of Toolbox, these controls exist for helping layout.

Form-wise you also have the option of using MDI (perhaps what you meant by embed forms?), and other multi-forms layout like tool windows, dialogs, and plain separate forms that can be shown simultaneously or in succession.

User-controls can be used to design an area like a form as a single composite control, this also makes it easier to add/replace sections of controls at the same time in a single form.
 
I appreciate all of the responses. I did take a look at the Container section and I don't see anything that would help me.

I don't understand what I am missing. I would think this would be a lot easier. In web programming, I have a master page, and then everything inside are just new pages. I can even drop things into multiple panels and turn their visible property on and off if I wanted to make things happen within the same page. I guess I am missing the correlation to Windows Form programming. I will admit, I am a huge fan of WYSWYG, but it seems like the only way to do this right is to dynamically create everything in code.

I tried to creating multiple panels, but then I can't select one Panel behind the other to make changes.

I tried using UserControls within a panel, but that was causing all kinds of problems.

I guess I am looking for how other people do it. You go into any larger Windows Form application and start clicking menu items, you see the entire work area change, but not the menu. I know I am missing some big concept here, I just can't figure out what it is. Sorry for venting, its just frustrating.
 
Depends on what you mean by "right", in my opinion when it comes UI design writing code should come second. You can use Visible property in Windows Forms too, but unlike web forms where things tend to "fall into" empty spaces, you have to place things explicitly if you want them to reposition by setting the Location property. One exception is the FlowLayoutPanel that does flow controls dynamically according to their visibility. But doing that visibility trick is a pain developing in designer, because everything never fits where only one thing is supposed to.

What resembles masterpages most in winforms development is the old MDI arrangement. Another option is designing a "master" form and inherit it in all other child forms, then display them in succession like you do in webforms.

It's always frustrating learning something new from start especially when you know a lot about doing the "same" in a different environment. I know a lot of windows and web development, but the new WPF platform just throws me over, I can't figure anything of it out by experience and intuition, guess I have to bite the bullet and start learning it from absolute beginner level.
 
Thanks for the quick reply. I like the sound of this option as I already have my menu setup so I would be using buttons. I did an object search for StackLayoutPanel and couldn't find anything. After a Google search, I saw this is a WPF control. I'm not ready to go down that road yet. Is there a way to do this within just Windows Forms?

I'm sorry, it's called a "FlowLayoutPanel"...don't know why I was stuck with Stack...whatever, the FlowLayoutPanel rearranges it's child controls autoamtically, based on the size and the visibility of the objects.

Bobby
 
I tried to creating multiple panels, but then I can't select one Panel behind the other to make changes.

I would favour the multiple panel route. When designing a form this way, I change the BackColor property of each panel as I put them onto the form, so it is obvious which panel you are working on. When you've finished designing that panel, right-click on it and choose Send to Back. It isnt ideal, but you can therefore cycle through all the panels.
 
I tried to creating multiple panels, but then I can't select one Panel behind the other to make changes.{/quote]
Use a tab control. Dont' try to reinvent something new because users won't like it.

Also, enable the Document Outline window, it will help you select elements of your form and alter their Z order

I tried using UserControls within a panel, but that was causing all kinds of problems.
If you missed the point JohnH was trying to make: UserControls are not what you want

I guess I am looking for how other people do it. You go into any larger Windows Form application and start clicking menu items, you see the entire work area change, but not the menu. I know I am missing some big concept here, I just can't figure out what it is. Sorry for venting, its just frustrating.

That sounds like MDI
 
Back
Top