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.
You can get the top index value using
listbox.TopIndexand the count usinglistbox.Items.Countbut I can’t see any way to get the bottom item withotu calculating it from the result oflistbox.GetItemHeight()andlistbox.ClientSize.Height:This can be done on a timer as I see no scroll event.