Home All Groups Group Topic Archive Search About

rich text maximum number of lines

Author
4 Apr 2006 10:59 AM
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

Author
5 Apr 2006 7:34 AM
R. MacDonald
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


ArtOfSpe***@gmail.com wrote:

Show quoteHide quote
> 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
>
Author
9 Apr 2006 8:35 AM
ArtOfSpeech
thanx alot R. MacDonald
your the man