By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,239 Members | 1,505 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,239 IT Pros & Developers. It's quick & easy.

rich text maximum number of lines

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
thanx alot R. MacDonald
your the man

Apr 9 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.