How to go about removing lines of text at the top of a RichTextBox

B

Benny Raymond

I have lines of data coming from a server being written to a
RichTextBox... The problem is that if I let this program run for a long
period of time there are hundreds of lines of text showing up in the
RichTextBox..

How would I go about setting a buffer size that would remove old lines
as new ones are being added? Also, how can I do this without removing
the formatting in the box. (I tried to do some array manipulation and
replace the lines in the box but the formatting went away)

thanks!

Benny
 
N

Nicholas Paldino [.NET/C# MVP]

Benny,

If you want to remove lines, you will have to actually take the text,
remove the first lines or so, and then set the text on the textbox back.

You might want to consider a grid or something with a list of items.
This way, you can remove the item from the bound data source, and it will
update accordingly.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top