Click here to Skip to main content
15,850,103 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends,

I am working in windows application which contains 3 groupboxes & the few controls are placed in it.3 groupboxes is made to act as 3 forms by dynamically changing the size of the forms & the visibility properties respectively.
The problem is managing the visibility properites of the controls.
I have a button "Home" in the 3rd groupbox which appears to be the 3rd page physically.Though I had set the visibility property of the 1st groupbox to be true in the button click event "Home", I am not able to view the first groupbox (which appears to be the 1st page)on clicking "Home" Button.

Kindly advise to solve this problem.


Perhaps in button click event "Home" you need also to hide the other groupboxes first.
Share this answer
Aabidhabanu 5-Aug-11 4:43am    
Yes I have done it.Yet I am facing the problem
chemark 5-Aug-11 5:01am    
You might have forgotten to add the GroupBox to its parent's Controls property with the Controls.Add() method.

or try

Aabidhabanu 5-Aug-11 5:07am    
I have done it already.Yet I am facing the problem :(

Personally, I wouldn't use a Group box for this, I'd probably use a panel. But, all the same, GroupBoxes will work.

I created a new form, and dropped two group boxes on to it.
Each box got a button.
private void button1_Click(object sender, EventArgs e)
    groupBox1.Visible = false;
    groupBox2.Visible = true;
private void button2_Click(object sender, EventArgs e)
    groupBox1.Visible = true;
    groupBox2.Visible = false;
As expected it worked fine.
What I supect you have done is created your group boxes, populated them, and dragged them so they all overlap. What you have actually done is made your boxes contain each other - you have dropped a group box onto another.

Go back to design mode, and separate them so they are all sitting on the form separately. Now change each of them so that Dock Property is set to Fill. It will work - but you would still be better with either tab pages or panels IMHO.
Share this answer
Aabidhabanu 5-Aug-11 5:04am    
As you said,I have already placed all the controls with enough space in the forms so that the groupboxes doesn't overlap with each other..I need the "Name" of the parent control to be visualy seen in screen.That's why I opted for groupbox. The name of the control is not visible in panel.

Thanks & regards

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900