Hi, There is a way to keep the scroll on bottom for a multi line textbox?
Something like in the vb6
txtfoo.selstart=len(txtfoo.text)
I'm trying with txtfoo.selectionstart=txtfoo.text.length without success.
Regards.
Hi, There is a way to keep the scroll on bottom for a multi line textbox?
Something like in the vb6
txtfoo.selstart=len(txtfoo.text)
I'm trying with txtfoo.selectionstart=txtfoo.text.length without success.
Regards.
Ok, I found that the solution is to use txtfoo.AppendText instead of txtfoo.text+="something"
The other solution is to use:
txtfoo.Text += "something";
txtfoo.SelectionStart = txtfoo.Text.Length;
txtfoo.ScrollToCaret();
Interesting question. I'm guessing that you are trying to select the text via form load? I can't get it working on form load, but I can on form click. Wierd. :)
Public Class Form1
Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click
ScrollTextbox()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ScrollTextbox()
End Sub
Private Sub ScrollTextbox()
TextBox1.SelectionStart = TextBox1.TextLength
TextBox1.ScrollToCaret()
End Sub
End Class
If it is completely necessary, you could use a timer.