© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago
koopa

Prevent scrollbar from jumping down when viewing a list?

Hi - I'm making a chat room in windows forms and have a listbox that displays all the messages recieved, ofcourse I have the chatbox set to automatically scroll to the bottom when a new item is sent. However, if the user is looking at old messages and a new item is sent, the scroll bar immediately jumps to the bottom.

I was thinking that I could do something like if(scrollBarPosition > scrollBarBottom) doNotJumpToBottom

except I can't seem to find any scroll bar position variable.
This is my jump to the bottom code:

chatListBox.TopIndex = chatListBox.Items.Count - 1;
chatListBox.TopIndex = chatListBox.Items.Count - 1;
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Viewing List from ViewBag
C#CC# / help
4y ago
❔ Preventing a panel from overflowing + show scrollbar WPF
C#CC# / help
3y ago
ScrollBar in a winform
C#CC# / help
3y ago
❔ Get list of indices from a List
C#CC# / help
3y ago