[VB.NET 2005] limiting the lines of text in a richtextbox control

P

plonk

Hi
I am writing an application that uses a RTB as an event log that
writes each event in a new line under the last event.. I only want to
store about 100 lines of events so the log doesn't grow too large or
exceed any limits, but I can't figure out how to put that limit into
place.

So as new events are logged, I want to be able to remove the old
events so the line limit is maintained at 100.

I someone please give me some hints on how that might be achieved?

many thanks... :D

paul.
 
P

plonk

plonk said:
Hi
I am writing an application that uses a RTB as an event log that
writes each event in a new line under the last event.. I only want to
store about 100 lines of events so the log doesn't grow too large or
exceed any limits, but I can't figure out how to put that limit into
place.

So as new events are logged, I want to be able to remove the old
events so the line limit is maintained at 100.

I someone please give me some hints on how that might be achieved?

many thanks... :D

paul.

bah. I figured it out..

a bit untidy but it works great :D

txtCount += 1
If txtCount = 100 Then
myEventLog.SelectionStart = 0
myEventLog.SelectionLength = myEventLog.Text.IndexOf(Chr(10), 0) + 1
myEventLog.SelectedText = ""
txtCount -= 1
End If
 

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