VS 2008 How to scroll down a textbox automatically?-VBForums
Results 1 to 7 of 7

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
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    97,341

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  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
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    97,341

    Re: How to scroll down a textbox automatically?

    Exactly what the name suggests it is: the new text.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  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
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    97,341

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.