Results 1 to 8 of 8

Thread: How to scroll down a textbox automatically?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2011
    Posts
    86

    How to scroll down a textbox automatically?

    Hello there,


    I am working on a LAN chat and I am having a problem. It's about the textbox that shows the conversation, it doesn't scroll down automatically, you have to do that manually. So is there something could make it scrolls down automatically? Something like showing the end or the bottom of the textbox.

    Is it clear for you folks?


    Thanks in advance!

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: How to scroll down a textbox automatically?

    You can do this at any time:
    Code:
    myTextBox.SelectionStart = myTextBox.TextLength
    myTextBox.ScrollToCaret()
    That said, you probably don't need to do that. The issue is probably that you are adding text to the TextBox like this:
    Code:
    myTextBox.Text &= newText
    By setting the Text property you will automatically scroll back to the top of the control. If you do this instead:
    Code:
    myTextBox.AppendText(newText)
    then you will automatically scroll to the end of the control.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2011
    Posts
    86

    Re: How to scroll down a textbox automatically?

    Newbie question.
    What is (newText)?

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: How to scroll down a textbox automatically?

    Exactly what the name suggests it is: the new text.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    May 2011
    Posts
    86

    Re: How to scroll down a textbox automatically?

    Thank you very much! The first one worked perfectly.

  6. #6
    New Member
    Join Date
    Dec 2017
    Posts
    1

    Re: How to scroll down a textbox automatically?

    jmcilhinney, just a note to thank you for the appendtext command. It got me going again.

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: How to scroll down a textbox automatically?

    Quote Originally Posted by Infogleaner View Post
    jmcilhinney, just a note to thank you for the appendtext command. It got me going again.
    I'm happy to be the gift that keeps on giving.

  8. #8
    PowerPoster Poppa Mintin's Avatar
    Join Date
    Mar 2009
    Location
    Bottesford, North Lincolnshire, England.
    Posts
    2,429

    Re: How to scroll down a textbox automatically?

    Quote Originally Posted by jmcilhinney View Post
    You can do this at any time:
    Code:
    myTextBox.SelectionStart = myTextBox.TextLength
    myTextBox.ScrollToCaret()
    That said, you probably don't need to do that. The issue is probably that you are adding text to the TextBox like this:
    Code:
    myTextBox.Text &= newText
    By setting the Text property you will automatically scroll back to the top of the control. If you do this instead:
    Code:
    myTextBox.AppendText(newText)
    then you will automatically scroll to the end of the control.
    I don't understand why this doesn't work for me !

    I have a current thread: "Why is my TextBox not scrolling to the end ? "

    Poppa
    Along with the sunshine there has to be a little rain sometime.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width