um.... I have a text box with a Vertical scroll bar, now from my program, I keep adding to the text box, is there a way to keep the scroll bar always at the bottem (so they see the new text that is being added)
Printable View
um.... I have a text box with a Vertical scroll bar, now from my program, I keep adding to the text box, is there a way to keep the scroll bar always at the bottem (so they see the new text that is being added)
You can set focus to the text box and Use the SendKeys to send the End key which will get you to the bottom
I never tried sendkeys before, how does it work?
You can use:
you can useCode:text1.setfocus
SendKeys "{end}"
Code:sendkeys "what ever you want"
that doesn't work for me
this works for me:
Code:Private Sub Command1_Click()
Dim leng, i, c As Integer
Dim char As String
leng = Len(Text1.Text)
For i = 1 To leng
char = Mid(Text1.Text, i, 1)
If char = Chr(13) Then
lines = lines + 1
End If
Next i
lines = lines + 1
Text1.SetFocus
For c = 1 To lines
SendKeys "{down}"
Next c
End Sub
Dim i
For i = 1 To 100
Text1.SelStart = Len(Text1.Text)
Text1.SelText = i & vbCrLf
Next i
sorry, none of the 2 above work. maybe I'm putting this in the wrong place,I'm putting it in the text change event
maybe you are.
let's see your usage of it.
if you cut and paste my code and click the button ten times the text box will scroll so you can read the last entry
It works if you put it under click event or something
Try putting the code that way and not under text1 change event
this isn't exactly it but something similar
Code:Public Sub Timer1_Timer ()
text1.text = text1.text & "fsadfkjasgdflkas"
End Sub
Private Sub Text1_change ()
'your code
end sub
ur text box is called Text1 right?
Code:Option Explicit
Public i As Integer
Private Sub Form_Load()
Timer1.Interval = 4
End Sub
Private Sub Timer1_Timer()
i = i + 1
Text1.Text = Text1.Text & "fsadfkjasgdflkas"
Text1.SelStart = Len(Text1.Text)
Text1.SelText = i & vbCrLf
If i = 20 Then Timer1.Enabled = False
End Sub