![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
In the Form_Load event, I'm running the following code after populating a TextBox from a file. The TextBox's MultiLine property is enabled and I have a vertical scrollbar on this control. This code DOES work if outside of the Form_Load event if when it's executed "after" the form is loaded. My question is this: Is there a Form event I can use or am I missing something regarding an event in the the control itself I should use? Here's the code: ' Set the cursor to the end of the textbox. txtScroll.SelectionStart = txtScroll.TextLength txtScroll.ScrollToCaret() ' Scroll down to the cursor position. |
#3
| |||
| |||
|
|
Am 05.03.2010 15:52, schrieb Freddo: In the Form_Load event, I'm running the following code after populating a TextBox from a file. The TextBox's MultiLine property is enabled and I have a vertical scrollbar on this control. This code DOES work if outside of the Form_Load event if when it's executed "after" the form is loaded. My question is this: Is there a Form event I can use or am I missing something regarding an event in the the control itself I should use? Here's the code: ' Set the cursor to the end of the textbox. txtScroll.SelectionStart = txtScroll.TextLength txtScroll.ScrollToCaret() ' Scroll down to the cursor position. Did you already try to place the 'ScrollToCaret' call in the form's 'Shown' event? In addition, take a look at this alternative method: Scrolling the textbox control to top or bottom URL:http://dotnet.mvps.org/dotnet/faqs/?id=textboxscroll&lang=en -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/ V B <URL:http://dotnet.mvps.org/dotnet/faqs/ |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |