-
Autoscolling Textbox
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
-
Re: Autoscolling Textbox
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
-
Re: Autoscolling Textbox
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
-
Re: Autoscolling Textbox
Thanks for the quick response ya'll! Works like a charm!
Jeff the appreciative programmer