Solved

Control Visibility

Posted on 2008-10-17
5
1,101 Views
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?
0
Comment
Question by:MichelleLacy
  • 3
5 Comments
 
LVL 3

Expert Comment

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

Author Comment

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

        {

            this.BindComboBox();

            this.buildExpressionTable();

            dgvListAnn.Visible = false;

            groupBox6.Visible = false;

        }
 

.....
 

private void btnSubmit_Click(object sender, EventArgs e)

        {

            if (expressionBuilder.Rows.Count > 0)

            {

                this.getList();

                groupBox5.Visible = false;

                groupBox6.Visible = true;

                dgvListAnn.Visible = true;

                this.retrieveData();

                this.BindComboBox2();

            }

            else

            {

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

            }

            

        }

Open in new window

0
 

Author Comment

by:MichelleLacy
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?
0
 
LVL 15

Accepted Solution

by:
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:
              this.getList();
                groupBox5.Visible = false;
                groupBox6.Visible = true;

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

Author Closing Comment

by:MichelleLacy
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.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

706 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