Texbox scroll always below

Is there a way to keep the scroll below for a multi-line text box?

Something like vb6

txtfoo.selstart=len(txtfoo.text) 

I try with txtfoo.selectionstart = txtfoo.text.length without success.

Sincerely.

+4
source share
3 answers

Ok, I found that the solution was to use

 txtfoo.AppendText 

instead

  txtfoo.text+="something" 
+7
source

Another solution is to use:

 txtfoo.Text += "something"; txtfoo.SelectionStart = txtfoo.Text.Length; txtfoo.ScrollToCaret(); 
+4
source

Interest Ask. I assume that you are trying to select text through form loading? I can not get it to work with loading the form, but I can click on the form. 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 absolutely necessary, you can use a timer.

0
source

Source: https://habr.com/ru/post/1277459/


All Articles