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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:20:19+00:00 2026-05-26T16:20:19+00:00

i have a listbox and i would want to display a label displaying: scrolling

  • 0

i have a listbox and i would want to display a label displaying:

scrolling through items XXX to XYY of ZZZ.

how do I do this because using SelectedIndex will not be useful, as i would like the label to update even when nothing is selected. (scrolling too, it does not select an item).

update:
for example I have 200 items in my listbox. at any one time i can only display only 10 items because of my listbox’s height. so the label should read:

displaying items 1 to 10 of 200

or

displaying items 5 to 15 of 200

however i must take into account that there may not be any indices selected because i can simply scroll and not select anything.

  • 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-26T16:20:20+00:00Added an answer on May 26, 2026 at 4:20 pm

    You can get the top index value using listbox.TopIndex and the count using listbox.Items.Count but I can’t see any way to get the bottom item withotu calculating it from the result of listbox.GetItemHeight() and listbox.ClientSize.Height:

    int visibleCount = listBox1.ClientSize.Height / listBox1.ItemHeight;
    this.Text = string.Format("{0:d} to {1:d} of {2:d}", listBox1.TopIndex + 1, listBox1.TopIndex + visibleCount, listBox1.Items.Count);
    

    This can be done on a timer as I see no scroll event.

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

Sidebar

Related Questions

I have a ListBox on a WPF form. I would like to display a
I have a ListBox containing a group of 'Expander' items, and what I would
Apologies for the ambiguous title. I want the items of my listbox to display
I have a listbox with runat=server Items are added to this listbox on the
I have a List of about 20 items I want to display to the
I have a WPF ListBox that I would like to Enable multiple selection in
I have a system.collections.generic.list(of ListBox) I would like to use the collection classes built-in
I am stuck here, any help would be appreciated. I have a listbox of
Ok, I have the following problem: I would like to scroll an overflowing ListBox
i have a report that is attached to a query i want to display

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.