Hello everyone.
I am currently working on my own "Colored textbox control" which inherits from the RichTextBox. What does the "Lines" property do? Does it generate the return array internally, or is it just passing back an array that is internally stored?
E.g. I use this:
Can I skip the generation of "lines" and just use Me.Lines(i) etc. everywhere?Code:Public Sub SelectLines(ByVal lineindex As Integer, Optional ByVal linecount As Integer = 1) Dim lines() As String = Me.Lines If lineindex > lines.Count - 1 Then lineindex = lines.Count - 1 If lineindex + linecount > lines.Count Then linecount = lines.Count - lineindex Dim selstart As Integer = 0 Dim sellength As Integer = 0 For i As Integer = 0 To lineindex + linecount - 1 If i < lineindex Then selstart += lines(i).Length + 1 Else sellength += lines(i).Length + 1 Next If sellength > 0 Then sellength -= 1 Me.SelectionStart = selstart Me.SelectionLength = sellength Me.Focus() End Sub
The reason I ask is that I want to minimize the lag of the control, and I have to read all or a range of lines fairly commonly.![]()




Reply With Quote