[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Closing SplitContainer's panel with a standard button

Posted on 2008-11-10
Medium Priority
Last Modified: 2012-06-21

I have a SplitContainer with two panels.  I want to make one of them to be closed with a standard Windows closing button (X - Button).

Any comments will be helpful.


Question by:afikim
  • 2
  • 2
LVL 48

Accepted Solution

jpaulino earned 280 total points
ID: 22922632
You can do:
Me.SplitContainer1.Panel1Collapsed = False

Open in new window


Author Comment

ID: 22923436
Hi JPaolino

I tried your code.  It doesn't do what I need.
I need the panel to be with "X" button for closing it.  Is there any standard closing button to do that?



LVL 48

Expert Comment

ID: 22923556
>> I need the panel to be with "X" button for closing it.  Is there any standard closing button to do that?
You can create your "X" button and use that code.
Maybe I'm not understand it right!

Assisted Solution

gisTimmy earned 220 total points
ID: 22924186
I think what jpaulino means is that you would have to put a Button on your form and put this in the button's click event:

SplitContainer1.Panel1Collapsed = True

This would close Panel1 of the Split Container (The left panel for a vertical splitter, or the top panel for a horizontal splitter).

If you want to re-open the panel, you use "SplitContainer1.Panel1Collapsed = False"

Best would be to code the button to toggle the collapse:

  SplitContainer1.Panel1Collapsed = Not SplitContainer1.Panel1Collapsed

This would collapse the panel if is isn't collapsed, and open it if it is collapsed.

Author Closing Comment

ID: 31515053
Hi JPaulino and gisTimmy

First I thought that there might be a standard "close button to the panel but now I understand that there isn't such a button.

As for the code JPaulino wrote,  I was a little confused.  It should have beed "Me.SplitContainer1.Panel1Collapsed = True" .

Thanks you both and enjoy your day


Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month19 days, 14 hours left to enroll

873 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