RichTextBox Line Flow

onez7285

Newcomer
Joined
Oct 31, 2004
Messages
3
I want text to flow down the textbox just like a console window but cannot.
People advised me to do this but you cannot even only see the first line at the top.
m_textbox.SelectionStart = m_textbox.Text.Length;
m_textbox.ScrollToCaret();

This almost works just when the WriteLine() function called:

1) if input line contains "\n", split the lines
2) loop through split lines, split line up again by character width of textbox
3) loop through these lines and add line length to queue, accumulate char count, deque old line (if count = 8) and remove old line length from queue so it is not visible :eek:
4) Set the selection start to TextBox.Length - AccumulatedLineCount and scroll

This runs slow and doesn't work for just the Write() function or entered text. Any help would be extremely appreciated.
 
I'm not entirely sure what your trying to accomplish, but if you want your textbox to autoscroll down like the console does, Make sure your textbox has the multi-line property to true and turn on wordwrap. Then if you wanted the text to scroll down in your textbox, you could use scrolltocaret. Also, Instead of using \n, why don't you just do something like,

m_textbox.Text &= vbCrLf

That would start a new line on your text box, without having to search for a special character to move to the next line. And If You Added The "&", You keep all the old text and you can just start concatenating any new strings.

-=Simcoder=-
 
Back
Top