Textbox not scrolling
-
I've got a textbox that updates with some information when an event fires. The textbox multiline value is set to true. A message is appended to a new line in the textbox. But if the number of lines exceeds the size of the control, the vertical scroll bar appears, but it stays at the top position. It wont automatically scroll down to the last entry. I've been trying:
TextBox1.Text = TextBox1.Text & vbCrLf & Message TextBox1.SelectionStart = TextBox1.Text.Length
orTextBox1.Text = TextBox1.Text & vbCrLf & Message TextBox1.Select (TextBox1.Text.Length, 0)
But no luck. Any ideas? -
I've got a textbox that updates with some information when an event fires. The textbox multiline value is set to true. A message is appended to a new line in the textbox. But if the number of lines exceeds the size of the control, the vertical scroll bar appears, but it stays at the top position. It wont automatically scroll down to the last entry. I've been trying:
TextBox1.Text = TextBox1.Text & vbCrLf & Message TextBox1.SelectionStart = TextBox1.Text.Length
orTextBox1.Text = TextBox1.Text & vbCrLf & Message TextBox1.Select (TextBox1.Text.Length, 0)
But no luck. Any ideas?Hi, when the caret is present, you can make the line containing it visible with TextBoxBase.ScrollToCaret() :)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google