Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Windows Forms hide sections

Posted on 2014-03-10
4
Medium Priority
?
814 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 2000 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 64

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 84

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

782 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