Solved

Windows Forms hide sections

Posted on 2014-03-10
4
767 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 63

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 82

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

Command Line Tips and Tricks

The command line is a powerful tool at the disposal of every Linux user. Although Linux distros come with beautiful user interfaces, it's worthwhile to learn the command line because it allows you to do a number of things that you otherwise cannot do from the GUI.  

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

632 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