Control Visibility

Posted on 2008-10-17
Last Modified: 2013-12-17
I have a form with two groups of controls.  On form load group2.visible = false, once the user clicks a button I have group1.visible=false and group2.visible=true.

Well the group1 controls disappear, but group2 controls do not reappear.  What am I doing wrong?
Question by:MichelleLacy
  • 3

Expert Comment

ID: 22741993
Can't answer that without seeing the code.

Author Comment

ID: 22742080
I hope this helps.
 private void Form4_Load(object sender, EventArgs e)




            dgvListAnn.Visible = false;

            groupBox6.Visible = false;



private void btnSubmit_Click(object sender, EventArgs e)


            if (expressionBuilder.Rows.Count > 0)



                groupBox5.Visible = false;

                groupBox6.Visible = true;

                dgvListAnn.Visible = true;






                MessageBox.Show("Expression Table is empty. Please add your query.");




Open in new window


Author Comment

ID: 22742836
I stepped through the debug process and noticed that the app was not chaning the visibility back to true.  Does it have to do with its status in the form.  Once the form is loaded it is set not to be visible, does the form need to be re-loaded?  will I lose the data in the arrays if the form is reloaded?
LVL 15

Accepted Solution

angus_young_acdc earned 500 total points
ID: 22755856
No you shouldn't have to re-load the form, when your code does the check that the are 1 or more rows does it definately hit these:
                groupBox5.Visible = false;
                groupBox6.Visible = true;

If so it would seem that somewhere in your code you are constantly stating groupBox6.Visible = false;

Author Closing Comment

ID: 31507832
you are correct.  I found the problem.  To save space on the form, I put controls on top of each other and thought if I hid and unhid I could get around using another form.  But the controls are always hidden beneath another control.  So I used a tabcontrol container in the form.  thanks.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
egit plugin on eclipse 8 31 adjust Screen Resolution 6 40
Syntax Error 2 43
Connection String 16 42
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project ( automates most of the tasks discussed in this article. You can even fin…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now