Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text Box autoscroll when filling with data 1

Status
Not open for further replies.

StellaIndigo

IS-IT--Management
Sep 19, 2002
118
0
0
GB
Hi

This maybe a simple solution to something I've lost the plot with,

I have a text box on a form that is filled with status data as a process is running. The box fills OK (normally with 900 lines of status data) It has 10 lines of text in view.

My problem is that the box does not Autoscroll as lines are add beyond the viewable area. I have to wait until the end of the process before I can manually drag the slider down to the bottom line of data. What I need is for the last line added to be in view.

I'm Application.DoEvenets() so,

Code:
me.txtStatusData = txtLastStatusMessage
Application.DoEvents()

Am I missing something???

Thanks

Stella

Regards
Stella

There are 10 types of people in the world. Those that understand binary and those that don't.
 
me.txtStatusData = txtLastStatusMessage

'move cursor to end of text
me.txtStatusData.SelectionStart = me.txtStatusData.Text.Length

Application.DoEvents()

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day! Ye has a choice: talk like a pira
 
StellaIndigo,

This is the code I use to do the exact same thing:
Code:
'Set the Caret to the last character in the textbox
txtHostResponse.SelectionStart = txtHostResponse.TextLength
'Scroll to the Caret
txtHostResponse.ScrollToCaret()
Application.DoEvents()

Senior Qik III, ASP.Net, VB.Net ,SQL Programmer

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SELECT * FROM Users WHERE clue > 0
0 Rows Returned
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
thanks for the feedback. the select then move to caret does work.

there is a slight display error with this method you see the first lines flicker in the view when the select move runs but it's ok for my needs.

might try a list box to resolve this issue for future reference.

thanks again.

Regards
Stella

There are 10 types of people in the world. Those that understand binary and those that don't.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top