Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7840553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:49:35+00:00 2026-06-02T15:49:35+00:00

Forms in an application I’m working on with a team have a datagridview as

  • 0

Forms in an application I’m working on with a team have a datagridview as main component (it should take up most of the size), but there are other components. there is a horizontal splitcontainer to split them, but I was wondering how to make the top panel resize to its contents. Unfortunately, the panels in a splitcontainer don’t have an AutoSize property…

Here are two images to show what we need:
image1
(source: mediafire.com)

image2
(source: mediafire.com)

As you can see, the top panel of the splitcontainer should adjust to the size of its contents. Is there any way to achieve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T15:49:36+00:00Added an answer on June 2, 2026 at 3:49 pm

    I’m assuming you meant “horizontal” split container based on your image.

    You can try achieving this manually by using the ControlAdded event of the top panel:

    Public Class Form1
    
      Public Sub New()
        InitializeComponent()
      End Sub
    
      Private Sub Form1_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
        SplitContainer1.SplitterDistance = SmallPanel.Height
      End Sub
    
      Private Sub SplitContainer1_Panel1_ControlAdded(ByVal sender As Object, ByVal e As ControlEventArgs) Handles SplitContainer1.Panel1.ControlAdded
        SplitContainer1.SplitterDistance += e.Control.Height
      End Sub
    
      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim addPanel As New Panel
        addPanel.BorderStyle = BorderStyle.FixedSingle
        addPanel.Size = New Size(SplitContainer1.Panel1.ClientSize.Width, 100)
        addPanel.Location = New Point(0, SplitContainer1.SplitterDistance)
        addPanel.Anchor = AnchorStyles.Left Or AnchorStyles.Top Or AnchorStyles.Right
        SplitContainer1.Panel1.Controls.Add(addPanel)
      End Sub
    
    End Class
    

    SmallPanel is a panel I placed in Panel1 of the SplitContainer and added a button in their to add more panels.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Windows Forms application that I'm working on, but I'm having trouble
I have a windows forms application in .NET 3.5. There's one form with 20
I have a windows forms application containing a datagridview control. The datagridview is populated
I have a Windows Forms application with a DataGridView in one of the forms.
I have a Windows Forms application that when the Main Window is closing, it
I have a windows forms application in c# and I wonder if there is
I have a CheckedListBox in my Windows forms application, but items can be added
In my Windows Forms Application, basically I have two DataGridView s. I want to
I have a windows forms application that reads and updates an XML file with
In System.Windows.Forms.Application there are two properties called LocalUserAppDataPath and UserAppDataPath . On this computer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.