Solved

Windows Forms hide sections

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

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
crm development 2 37
work allocation; web development; vba; access; 4 46
Problem to open Excel file 15 44
Achieve json result 2 35
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…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 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