W
WALDO
I have a .Net TextBox (TextBoxBase, really) in which I am appending about 20
lines of text per second. I use the AppendText() method to accomplish this.
This is a great substitute for taking the Text property and concatenating
it...
Me.tb.Text &= newText
' Instead use
Me.tb.AppendText(newText)
....ultimately setting the SelectionStart to the end of TextBox, the
SelectionLength to the length of the new text and replacing the SelectedText
(via the SendMessage API function, determined by using Lutz Roeder's
Reflector).
This keeps the cursor at the end of the TextBox as text is appended to it
without flicker. I wish to perform this same function, but keep the cursor
position where it is (if it is not at the end of the TextBox). If I persist
the selection position and length before I append the text and restore them
aftrer, it creates AWFUL flicker.
Is there a message I can send, maybe using the SendMessage API, that will
append text but not change the position or the selection?
Picture the Output Window in Visual Studio as you are debugging and calling
Debug.WriteLine(newText) at the same rate. If your cursor is set at the end
of the TextBox, it stays at the end as lines are written. If you select some
text, your selection stays where it is, but text is still appended. That's
exactly what I'm trying to do.
Dim i As Integer
For i = 0 To 10000
Debug.WriteLine("I am writing line " & i)
Next
Any help is appreciated.
Thanks in advance.
WALDO
lines of text per second. I use the AppendText() method to accomplish this.
This is a great substitute for taking the Text property and concatenating
it...
Me.tb.Text &= newText
' Instead use
Me.tb.AppendText(newText)
....ultimately setting the SelectionStart to the end of TextBox, the
SelectionLength to the length of the new text and replacing the SelectedText
(via the SendMessage API function, determined by using Lutz Roeder's
Reflector).
This keeps the cursor at the end of the TextBox as text is appended to it
without flicker. I wish to perform this same function, but keep the cursor
position where it is (if it is not at the end of the TextBox). If I persist
the selection position and length before I append the text and restore them
aftrer, it creates AWFUL flicker.
Is there a message I can send, maybe using the SendMessage API, that will
append text but not change the position or the selection?
Picture the Output Window in Visual Studio as you are debugging and calling
Debug.WriteLine(newText) at the same rate. If your cursor is set at the end
of the TextBox, it stays at the end as lines are written. If you select some
text, your selection stays where it is, but text is still appended. That's
exactly what I'm trying to do.
Dim i As Integer
For i = 0 To 10000
Debug.WriteLine("I am writing line " & i)
Next
Any help is appreciated.
Thanks in advance.
WALDO