How to keep a vertical scrollbar on a multiline textbox always scrolled down?

Posted on 2006-05-09
Medium Priority
Last Modified: 2008-02-01
How to keep a vertical scrollbar on a multiline textbox always scrolled down?

My multiline textbox is being used as a chat text box.  When the text inside gets too big I have to trim the top but keep the chat contents on the bottom.

            If txtMessageHistory.Text.Length > 2048 Then
                'take the last 2048 characters and set that
                txtMessageHistory.Text = txtMessageHistory.Text.Substring(txtMessageHistory.Text.Length - 2048, 2048)
                'scroll the scrollbar all the way down
                ?? HELP
            End If

The scrollbar gets set all the way up instead of staying scrolled down.

Any suggestions?
Question by:Hepen
LVL 19

Accepted Solution

arif_eqbal earned 2000 total points
ID: 16645668
To scroll to the bottom


This should do....
However what I can understand is, that you have a chat page where user types in one textbox and on send button it goes to the Display Text box and for that you are using something like  
       txtMessageHistory.Text &= TextBox1.Text
instead of that try
The scroll bar would automatically be at the end


Expert Comment

ID: 16646737
Why not use this where you have 'scroll the scrollbar all the way down:-

txtMessageHistory.SelectionStart = txtMessageHistory.Text.Length - 1

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month16 days, 16 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question