rich text maximum number of lines

  • Thread starter Thread starter ArtOfSpeech
  • Start date Start date
A

ArtOfSpeech

hi....
Can anyone tell me plz how to set a maximum number of (lines) to a
rich text control and show only last linse when number of lines exceeds

the maximum number???

i've tried to use richtext.lines array to determine lines length but i
can remove from it cause its of system array type and is length fixed
which means i cant add or remove elements from it...


thx in advance
 
Hello, Art,

Are you trying to do something like this?

Private mstraLines As String() = {"First Line"}

Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click

Const kinMaxLines = 4
Dim intTotalLineCount As Integer = UBound(mstraLines) + 1
ReDim Preserve mstraLines(intTotalLineCount)
mstraLines(intTotalLineCount) = "This is new line # " & _
intTotalLineCount
intTotalLineCount = intTotalLineCount + 1
Dim intLinesToShow As Integer = intTotalLineCount
If (intLinesToShow > kinMaxLines) Then
intLinesToShow = kinMaxLines
End If
Dim intFirstLine As Integer = intTotalLineCount - intLinesToShow
Dim straLinesToShow(intLinesToShow - 1) As String

Array.Copy(mstraLines, intFirstLine, _
straLinesToShow, 0, intLinesToShow)

RichTextBox1.Lines = straLinesToShow

End Sub

Cheers,
Randy
 
Back
Top