locked
Two quick questions about TextBoxes RRS feed

  • Question

  • NOTE: Using C++/CLI.

    1. What is the easiest way to make a textbox automatically scroll down to see the newest input text?

    2. What would be the easiest way to remove the oldest (top) line of text from a multiline textbox after the number of lines reaches 100?

    EDIT: Question 2 is resolved. I only need to know how to make it automatically scroll.

    Tuesday, June 29, 2010 2:07 PM

Answers

  • Hi spirobulldog08,

    You can set SelectionStart to move the caret to the end of the text. Then you can call ScrollToCaret to scroll to the end of the textbox.

    For example:

    textBox1->SelectionStart = textBox1->Text->Length;
    textBox1->ScrollToCaret();

    Cheers,

    Yi


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Thursday, July 1, 2010 7:18 AM

All replies

  • Hi spirobulldog08,

    You can set SelectionStart to move the caret to the end of the text. Then you can call ScrollToCaret to scroll to the end of the textbox.

    For example:

    textBox1->SelectionStart = textBox1->Text->Length;
    textBox1->ScrollToCaret();

    Cheers,

    Yi


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Thursday, July 1, 2010 7:18 AM
  • Thank you!
    Thursday, July 1, 2010 12:38 PM