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

  • Home
  • SEARCH
  • 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 6773771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:42:27+00:00 2026-05-26T15:42:27+00:00

I have a ListBox in winforms , C# application. i need to add to

  • 0

I have a ListBox in winforms , C# application.
i need to add to the ListBox CheckBoxes in the code , and i need that HorizontalScrollbar will appear when there is a lot of CheckBoxes and the ListBox can’t show them all.
I have placed the ListBox on the Window and set it’s HorizontalScrollbar to be true. Also i have set the maximum height and width for the ListBox.But when i run the application , i can’t see all the CheckBoxes…
can anyone help with that?

this the code for adding the checkboxes :

            listBox1.HorizontalScrollbar = true;
            this.groupBox_ChooseTCPipConfg.Controls.Add(listBox1);
            CheckBox chk1 = new CheckBox();
            chk1.Text = "chk1";
            chk1.Location = new Point(2, 2);
            listBox1.Controls.Add(chk1);
            CheckBox chk2 = new CheckBox();
            chk2.Text = "chk2";
            chk2.Location = new Point(2,22);
            listBox1.Controls.Add(chk2);
            CheckBox chk3 = new CheckBox();
            chk3.Text = "chk3";
            chk3.Location = new Point(2, 42);
            listBox1.Controls.Add(chk3);
            CheckBox chk4 = new CheckBox();
            chk4.Text = "chk4";
            chk4.Location = new Point(2, 62);
            listBox1.Controls.Add(chk4);
            CheckBox chk5 = new CheckBox();
            chk5.Text = "chk5";
            chk5.Location = new Point(2, 82);
            listBox1.Controls.Add(chk5);
            CheckBox chk6 = new CheckBox();
            chk6.Text = "chk6";
            chk6.Location = new Point(2, 102);
            listBox1.Controls.Add(chk1);
            CheckBox chk7 = new CheckBox();
            chk7.Text = "chk7";
            chk7.Location = new Point(2, 122);
            listBox1.Controls.Add(chk7);
            CheckBox chk8 = new CheckBox();
            chk8.Text = "chk8";
            chk8.Location = new Point(2, 142);
            listBox1.Controls.Add(chk8);
            CheckBox chk9 = new CheckBox();
            chk9.Text = "chk9";
            chk9.Location = new Point(2, 162);
            listBox1.Controls.Add(chk9);
            CheckBox chk10 = new CheckBox();
            chk10.Text = "chk10";
            chk10.Location = new Point(2,202);
            listBox1.Controls.Add(chk10);

when i run the application , i can only see the first 7 checkboxes….

  • 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-26T15:42:28+00:00Added an answer on May 26, 2026 at 3:42 pm

    You dont’ have ListBox scroll because you didn’t add any items to it. You just place the CheckBox controls inside. Scroll appears oly if you will have to many items.

    For such purposes use FlowLayoutPanel control.

    Here is how properties should be set for FlowLayoutPanel

    enter image description here

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

Sidebar

Related Questions

I have a listbox control (in a WinForms application) that lists a bunch of
I have a .net winforms ListBox and I've added items to it using .Add().
I have a ListBox of constant size 4 I can Add n number of
I have two ListBox in my winforms application, I assigne a datasource for both
I have a user control that is hosting a winforms listbox. I am re-sorting
I have a ListBox in my winforms app and I need to handle the
I have a CheckedListBox (WinForms) control (which inherits from ListBox; googling shows that the
I have several winforms listbox controls I am hosting in a user control. The
I have a ListBox that has a style defined for ListBoxItems. Inside this style,
I have a listbox where the items contain checkboxes: <ListBox Style={StaticResource CheckBoxListStyle} Name=EditListBox> <ListBox.ItemTemplate>

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.