Solved

Windows Forms hide sections

Posted on 2014-03-10
4
715 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
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 video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

776 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