468,510 Members | 1,733 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,510 developers. It's quick & easy.

rich text maximum number of lines

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

Apr 4 '06 #1
2 1731
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
Ar*********@gmail.com wrote:
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

Apr 5 '06 #2
thanx alot R. MacDonald
your the man

Apr 9 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by PC User | last post: by
reply views Thread by David Killian Woods | last post: by
7 posts views Thread by TheGanjaMan | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.