Mr_Fulano
asked on
Scrolling back up to the Top of a Textbox control
Hi, I'm using VB.NET2010, WinForms. I have a Form with a textbox, where I append some text to the textbox after parsing an external text file. That part works well.
However, once all the text is appended, the scroll-bar is all the way down at the bottom of the file. I'd like to have the scroll bar move to the top of the file, so the user doesn't have to scroll back up manually to begin viewing the file.
I tried ScrollToCarrot(), but I'm not sure how to set the target "Carrot."
How would I do that or is there a better way?
Thanks,
Fulano
However, once all the text is appended, the scroll-bar is all the way down at the bottom of the file. I'd like to have the scroll bar move to the top of the file, so the user doesn't have to scroll back up manually to begin viewing the file.
I tried ScrollToCarrot(), but I'm not sure how to set the target "Carrot."
How would I do that or is there a better way?
Thanks,
Fulano
also, if that doesn't work for you,
use TextBox1.SelectionStart
use TextBox1.SelectionStart
Try setting the SelectionStart:
this.textBox1.SelectionStart = 0;
this.textBox1.Focus(); // If necessary (e.g. user clicks button to scroll)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Heheh...
Of course, in VB, you'd use "Me", not "this" : )
Of course, in VB, you'd use "Me", not "this" : )
ASKER
Most accurate solution. It worked as is. Thanks
Thanks
Open in new window