Hello All:

In asp.net there is a Multiview control which allows me to switch between panels programatically, so different sets of controls can selectively be displayed in the same area on screen.

I understand there is no such control in winForms but is there a best practice or technique for acheiving a similar operation?

Many thanks

Tino

Recommended Answers

All 4 Replies

Depending on how you want them to appear visually, i usually use a TabControl if i want different sets of controls that the user can switch between.
If i want to change them in code in response to input then i normally design each of the panels, then place them one on top of the other and set all of them to .visible=false; .enabled = false; except for the one i want to be visible currently.

Not sure this is the 'best practice' but its always worked for me :p

Thanks again Ryshad

Thats how I was going to do it (layerd panels) but wasnt sure if there was a better way.

Also looks like a bit of a mess on screen in VS, not easy to make alterations unless there is a way of disabling a panel on screen in VS too? Dont think so tho :-(

Many thanks for the help

Tino

I agree, designing them this way is a nightmare.
One option ive found is to lay them out side by side when im designing then set their location properties to all be the same when im done..either manually in the designer (edit the property rather than dragging them as you will probably end up with panels in panels if you drag them) or in the form load set their locations.

There may well be a better method, if there is i'd be keen to know it too :p I've always leaned more toward the TabControl since its neat and easy to use :p

One option ive found is to lay them out side by side when im designing then set their location properties to all be the same when im done..either manually in the designer (edit the property rather than dragging them as you will probably end up with panels in panels if you drag them) or in the form load set their locations.

Thanks for the tip - ill use that :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.