code_junkie

Scroll of a texbox always on bottom

Nov 11th, 2011
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. txtfoo.selstart=len(txtfoo.text)
  2.  
  3. txtfoo.Text += "something";
  4. txtfoo.SelectionStart = txtfoo.Text.Length;
  5. txtfoo.ScrollToCaret();
  6.  
  7. Public Class Form1
  8.  
  9. Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click
  10. ScrollTextbox()
  11. End Sub
  12.  
  13. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  14. ScrollTextbox()
  15. End Sub
  16.  
  17. Private Sub ScrollTextbox()
  18. TextBox1.SelectionStart = TextBox1.TextLength
  19. TextBox1.ScrollToCaret()
  20. End Sub
  21.  
  22. End Class
Add Comment
Please, Sign In to add comment