Solved

Windows Forms hide sections

Posted on 2014-03-10
4
699 Views
Last Modified: 2014-03-10
I have a windows form (C# code behind) that opens for the user to edit records. What I want to do is create sort of a 2nd part to the form, initially hidden. So the form actually is a certain size showing all controls, but when it opens it's not showing everything. I would like to have a button on the form that will hide or display the bottom half when clicked. Is there a way to do this?
0
Comment
Question by:dodgerfan
4 Comments
 
LVL 25

Accepted Solution

by:
SStory earned 500 total points
ID: 39918360
Sure, just resize the form.. Start with the form sized not showing them, then when the button is clicked change formname.height=new height, clicked again, change it back.
0
 
LVL 62

Expert Comment

by:Fernando Soto
ID: 39918480
You can place a panel in the area you want to hide and show and in that panel place all the control in the panel that you wish to hide and show. in the property window for the panel make the panel Visible property to false. then in the button click event to hide and show place this code.

 panel1.Visible = !panel1.Visible;

Open in new window

Then every click of that button will hide and show all the controls in the panel.
0
 
LVL 79

Expert Comment

by:David Johnson, CD, MVP
ID: 39918483
set the visible property of the items you want hidden to false. When you want to display them set the visible property of the controls to true

VisibleHidden
 private void button1_Click(object sender, EventArgs e)
        {
        webBrowser1.Visible = true;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            webBrowser1.Visible = false;
        }

Open in new window

0
 

Author Closing Comment

by:dodgerfan
ID: 39918870
That got it, thanks.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

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…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 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

23 Experts available now in Live!

Get 1:1 Help Now