BUG: TextBox content is not automatically scrolled to display selected text on receiving focus
Symptoms
When you programmatically select the content of a text box, and the selected content resides in the area that you cannot see of the TEXTBOX control, then the text in the text box does not scroll automatically to display the selected text. Also, when you move to the TEXTBOX control by pressing TAB, the selected text does not appear automatically when the text box receives the focus.
Resolution
To work around this problem, you can use the ScrollToCaret method of the TEXTBOX control. This method scrolls the content of the control to the current caret position.
Copy the following code to the textBox1_Enter event:
Visual Basic Code
textBox1.ScrollToCaret()Visual C# Code
textBox1.ScrollToCaret();

Leave a Reply