Hide part of form on load

Hi Experts,
I'm sure one of you can tell me a better way to accomplish what I need, but here is what I am trying to do.  Attached is a screen shot of the form I am currently working with.  What I'm trying to do is hide the bottom half of the form.  As you can see from the screen shot, I have my "Bank Information" and "Name On Check" fields inside a panel.  I only want those fields to show if the user clicks on the "Create New Profile" button.  I can accomplish this by hiding the panel when the form loads, but I don't want a big blank empty space for the bottom half of my window.  I can't find anything on how to hide part of a form, so I'm thinking there is a better way.
Who is Participating?
anarki_jimbelConnect With a Mentor Commented:
Code to use can be very simple.
I have a panel anchored to the bottom of a form (and to the sides).
And, for example, a button with the code you may see below:
        bool hidden;
        int panelheight = 184;

        private void button2_Click(object sender, EventArgs e)

            if (!hidden){
                hidden = true;
                this.panel1.Height = 0;
                this.Height = this.Height - panelheight;
                this.panel1.Height = panelheight;
                   hidden = false;
                this.Height = this.Height + panelheight;

Open in new window

Mike TomlinsonMiddle School Assistant TeacherCommented:
One way is just to grab the bottom of the form and drag it up so the bottom half isn't visible.  When the button is pressed you make the form bigger:

    this.Size = new Size(this.Size.Width, this.Seize.Height + 500); // <-- You need to experiment with what value works best for your form

Of course, you need to use some kind of variable to track whether or not the form is currently "expanded" so you don't try to expand it more.  To collapse the form just do the opposite and subtract the right amount...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.