I got it! I wrote a sub routine that will select the line that the cursor is on in the given RTB...heres the code if anyone's interested:VB Code:
Public Sub SelLine(RTB As RichTextBox) Dim x As Long, i As Integer Dim y As String, z As String, a As String y = 0 a = 0 z = 0 Dim bolBegin As Boolean, bolEnd As Boolean x = RTB.GetLineFromChar(RTB.SelStart) i = RTB.SelStart 'a = RtB.GetLineFromChar(i) If RTB.GetLineFromChar(i) = 0 Then bolBegin = True y = 1 End If If RTB.GetLineFromChar(i) = UBound(Split(RTB.Text, vbNewLine)) Then bolEnd = True z = Len(RTB.Text) End If Do Until RTB.GetLineFromChar(i) = x - 1 Or bolBegin = True i = i - 1 Loop i = i + 1 y = 0 If Not bolBegin Then y = i i = RTB.SelStart Do Until RTB.GetLineFromChar(i) = x + 1 Or bolEnd = True i = i + 1 Loop z = Len(RTB.Text) + 1 If Not bolEnd Then z = i z = z - y RTB.SelStart = y RTB.SelLength = z RTB.SetFocus End Sub




Reply With Quote