Click to See Complete Forum and Search --> : Autoscolling Textbox


Ghost308
July 13th, 2001, 09:12 AM
I need to send output in my program to a textbox on one of my forms. I use that textbox kinda like an event log. New data sent to it is appended to the text already there. Everytime data is sent, the textbox scrolls itself back up to the top- how do I make it autoscroll to the bottom of the text? Thanks!!!

Jeff

Clearcode
July 13th, 2001, 09:21 AM
After adding the text, set the SelStart to the end of the textbox thus:


Text1.SelStart = len(Text1.Text)




HTH,
Duncan

-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com

John G Duffy
July 13th, 2001, 09:23 AM
Here is a litle sample that miught be of interest.
Start a new project. Add a textBox and a command button. Paste this code into the general declarations section of the form. Run the program.
Click the command button after everything settles down.
The key to this is the Selstart, SetFocus and sendkeys.

option Explicit
Dim X

private Sub Command1_Click()
Text1.SetFocus
X = X + 1
SendKeys "This is line " & X & vbCr
End Sub

private Sub Form_Load()
me.Show
Text1.SetFocus
for X = 1 to 10
Text1.SelStart = len(Text1.Text)
SendKeys "This is Line " & X & vbCr
next X


End Sub




John G

Ghost308
July 13th, 2001, 09:34 AM
Thanks for the quick response ya'll! Works like a charm!

Jeff the appreciative programmer