How to make a listbox scroll horizontally
16,573
Solution 1
listbox.HorizontalScrollbar = true;
Solution 2
You should use listbox.HorizontalScrollbar = true;
Author by
Dee J. Doena
Updated on June 11, 2022Comments
-
Dee J. Doena almost 2 years
I have a listbox that contains a long string.
The beginning is not all that relevant for the user which is why I'd like to make the listbox scroll
automaticallyprogramatically to the right.You can scroll to the last item vertically but I've not yet found a way to simulate the user scroll to the right.
Any ideas?
-
Sriram Sakthivel over 10 years@Junaith What does that mean? What do you meant by auto?
-
Junaith over 10 yearsWhat I understood from the question is that if the selected item is not visible completely then the horizontal scroll should move to the end to display the last part.. atleast this is my understanding
-
Sriram Sakthivel over 10 years@Junaith This is also similar to
Auto
only. If items is fully visible scrollbar will not be shown, but it will not scroll to end. Doing so will be annoying. When you are scrolling vertically horizontal scrollbar will be moved automatically. No user will like that. -
Junaith over 10 yearsI completely agree that it would be annoying... but I thought thats what the OP wanted. I might be wrong... only OP can confirm
-
Dee J. Doena over 10 yearsJunaith is correct, I want to programatically move the horizontal scrollbar to the right-most position according to what is currently displayed in the list box. Strike the word automatically because you're right, that would be annoying. But I'm filling the listbox programatically and then uon display I want it be right-sided when the form is shown.