Click here to Skip to main content
15,887,350 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
i want to show two group box in windows forms application same place. for example first group box location is 10,10 and second group box location is also 10,10. now
when i click button 1 groupbox 1 is show on location 10,10 and groupbox 2 is hide on same location 10,10 .when i click button 2 groupbox 1 is hide on location 10,10 and groupbox 2 is show ?. tell me how can i do this....
Posted

Have a look at the Groupbox.Visible property.
 
Share this answer
 
Comments
raajaakhan 21-Apr-12 16:09pm    
goupbox1.visible=true;
groupbox2.visible=flase;
this code working with different location of the groupbox but i want both groupbox on same location hide and show
[no name] 21-Apr-12 16:11pm    
So? Make the location the same. There is something you are not saying.
AbO_OsAmH 21-Apr-12 16:17pm    
copy and paste location property in property tab ..... god luck
AbO_OsAmH 21-Apr-12 16:20pm    
use this code at form load event.

this.groupBox1.Location = this.groupBox2.Location;
Espen Harlinn 22-Apr-12 8:36am    
5'ed!
Hello ....

Just follow this steps :
1- put groupbox1 and groupbox2 in same location via property tab.
2- set Visible attribute false for groupbox2
C#
this.groupBox2.Visible = false ;

3- set Visible attribute false for groupbox1
C#
this.groupBox1.Visible = false ;

4- in buttons code write this code :

C#
private void btnShowGroupBox1_Click(object sender, EventArgs e)
        {
            this.groupBox1.Visible = !(this.groupBox2.Visible = false);
        }

        private void btnShowGroupBox2_Click(object sender, EventArgs e)
        {
            this.groupBox1.Visible = !(this.groupBox2.Visible = true);
        }

and Enjoy ....
 
Share this answer
 
Comments
raajaakhan 21-Apr-12 16:58pm    
Thanks brother :)
AbO_OsAmH 22-Apr-12 4:27am    
Good Luck ....
Espen Harlinn 22-Apr-12 8:36am    
5'ed!

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