Not sure if this helps, but........
I used this in VBA, it might come in handy. It does exactly what you want.
You would just need to translate it. (sorry!)
Function GetLines() As Variant
Dim lLines As Long
With MyForm.RichText1
.SetFocus
lLines = .LineCount
End With
ReDim arrTmp(lLines) As String
For X = 1 To lLines
'Set and select linenumber
SetLine X
'pick up text in line
arrTmp(X) = n
Next
'return values to function
GetLines = arrTmp
Erase arrTmp
End Function
Sub SetLine(ByVal LineNumber As Integer)
On Error Resume Next
'set linenumber
MyForm.RichText1.CurLine = LineNumber - 1
'make selection using sendkeys (argghh)
SendKeys "{HOME}", -1
SendKeys "+{END}", -1
If Err <> 0 Then Err.Clear
End Sub
--
Bob
--------------------------------------
I'll have a B please Bob.
"Mark Raishbrook" <ra********@mail.telepac.pt> wrote in message
news:41**********************@news.telepac.pt...
...without resorting to SendMessage. Imagine, for example,
I have a small RTB whose text has wrapped as follows:
"This is a small test to see if I can get"
"both of these lines".
GetLineFromCharIndex(RTB.TextLength) returns 1, telling me
there are two lines in there. Using the Lines property to
retrieve them will fail, however. As the line has
soft-wrapped (i.e. the user has not hit Enter after "get"),
it returns "This is a small test to see if I can get both of
these lines".
In VB6, SendMessage would come to the rescue here. Is there
a managed way of achieving the same thing?