tags:

views:

60

answers:

2

what is the best idea/technique to do this and I prefer not to create all these at run time and not using the Tabs control:

let's say we have three radio buttons on the form and based on the user selection we want to show him different GUI stuff ( checkbox, listbox, etc ... ) on the same form.

How to do that?

+2  A: 

Controls have a Visible property, that makes the control disappear when it is set to False. When a button is clicked, you could write some code that sets certain controls to be invisible.

FrustratedWithFormsDesigner
Nitpick: The `Visible` property is defined by the `Control` class itself. _Every_ control has it.
SLaks
+3  A: 

Set the controls' Visible property to false.

This will be easiest to do if you put the controls on different panels and show / hide the panels instead of hiding each control separately.

SLaks
yes, but I am thinking about the design time that I am actually designing these separate panels and controls inside each of them... so I will drop all these three panel on each other and say panel2.visible = true? ...
BDotA
Yes. Make sure that the panels aren't inside of eachother, though.
SLaks
@BDotA: Some container controls have automatic layout features, like the FlowLayout panel. You could put all three in, and then only turn one at a time and alignment within the container should always be OK.
FrustratedWithFormsDesigner
@ FrustratedWithFormsDesigner : nice, actually I was looking for some new technique like this, just using panels is Ok but VB 6.0 could do that too. So I will combine your technique with SLaks technique. thank you both.
BDotA