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 7650509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:16:11+00:00 2026-05-31T11:16:11+00:00

I have a class that generates a listview dynamically and placed it in a

  • 0

I have a class that generates a listview dynamically and placed it in a tab control. When the user resizes the form, I want to capture that event and resize the listview. I can set the dock property but directly on top of the grid there is a panel with a combo box ( allows user to sort of filter the data). And when I set the docking the grid docks to the top of the tab and doesn’t realize there is a combo there. Maybe i am doing something wrong.

Here is a sample code:

public class KI_Tab_Items_ListviewControl : KI_Tab_Items, IDisposable
{
    private ListView m_Listview = new ListView();
    private ComboBox m_ComboBox = new ComboBox();

    public ListView ListViewControl { get { return m_Listview; } set { m_Listview = value; } }
    public ComboBox ComboBoxControl { get { return m_ComboBox; } set { m_ComboBox = value; } }

    public override void ClearItems()
    {
        ListViewControl.Items.Clear();
    }
    public override void PopulateControls()
    {
        base.PopulateControls();
    }
    public virtual void AddColumnHeaders()
    {
        ListViewControl.Columns.Clear();
    }
    public KI_Tab_Items_ListviewControl(TabControl m_TabControl, int lIndex, bool DisplayComboBox = true)
    {
        if (m_TabControl.TabPages[lIndex].Controls.Count == 0)
        {
            int ListviewTop = 0;
            m_TabControl.TabPages[lIndex].Controls.Clear();
            if (DisplayComboBox)
            {
                m_TabControl.TabPages[lIndex].Controls.Add(ComboBoxControl);
                ComboBoxControl.Dock = DockStyle.Top;
                ComboBoxControl.Visible = true;
                ComboBoxControl.Left = 0;
                ComboBoxControl.Top = 0;
                ListviewTop = ComboBoxControl.Top + ComboBoxControl.Height;
            }

            m_TabControl.TabPages[lIndex].Controls.Add(ListViewControl);

            ListViewControl.Anchor = AnchorStyles.Top;
            ListViewControl.Dock = DockStyle.Bottom;
            ListViewControl.Visible = true;
            ListViewControl.Top = ListviewTop;
            ListViewControl.Height = m_TabControl.TabPages[lIndex].Height - ListviewTop;
        }
    }
    void System.IDisposable.Dispose()
    {
        Tab_Control.Controls.Clear();
        m_Listview = null;
        m_ComboBox = null;
    }
}
  • 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-05-31T11:16:12+00:00Added an answer on May 31, 2026 at 11:16 am

    Add ListView FIRST. Set ListViewControl.Dock = DockStyle.Fill.
    Add ComboBox LAST. Sett ComboBoxControl.Dock = DockStyle.Top.

    public void KI_Tab_Items_ListviewControl( TabControl m_TabControl, int lIndex, bool DisplayComboBox = true )
    {
        if ( m_TabControl.TabPages[ lIndex ].Controls.Count == 0 )
        {
            int ListviewTop = 0;
    
            m_TabControl.TabPages[ lIndex ].Controls.Clear();
    
            m_TabControl.TabPages[ lIndex ].Controls.Add( ListViewControl );
    
            // Add ListView FIRST.
            // NOTE: set ListViewControl.Dock = DockStyle.Fill;
            //
    
            ListViewControl.Anchor = AnchorStyles.Top;
            ListViewControl.Dock = DockStyle.Fill;
            ListViewControl.Visible = true;
            ListViewControl.Top = ListviewTop;
            ListViewControl.Height = m_TabControl.TabPages[ lIndex ].Height - ListviewTop;
    
            // Add ComboBox last.
            // NOTE: set ComboBoxControl.Dock = DockStyle.Top;
            //
    
            if ( DisplayComboBox )
            {
                m_TabControl.TabPages[ lIndex ].Controls.Add( ComboBoxControl );
                ComboBoxControl.Dock = DockStyle.Top;
                ComboBoxControl.Visible = true;
                ComboBoxControl.Left = 0;
                ComboBoxControl.Top = 0;
                ListviewTop = ComboBoxControl.Top + ComboBoxControl.Height;
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a php class that generates a map image depending on my db
I have a pseudo random number generator (PRNG) class that I want to unit
I have a class that I want to use to store properties for another
I have a class that generates PDF with Prawn: class CustomersReport < Prawn::Document def
I have a python class that generates the nth prime number by starting at
I have a constructor (for an auto generated class) that has 255 paremeters. Using
I have a buffer in class 'bufferClass' that will generate a signal to tell
I have an object that is generated in one class public class CreatingClass {
I have a span that is generated through javascript, with its css class as
I have a database that I would like class files generated from, and also

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.