C
C#2y 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;
0 Replies
No replies yetBe the first to reply to this messageJoin