Closing SplitContainer's panel with a standard button

Posted on 2008-11-10
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
    LVL 48

    Accepted Solution

    You can do:
    Me.SplitContainer1.Panel1Collapsed = False

    Open in new window


    Author Comment

    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

    >> 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

    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

    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

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    746 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

    14 Experts available now in Live!

    Get 1:1 Help Now