Results 1 to 20 of 20

Thread: HTML Highlighting

Threaded View

  1. #14
    Addicted Member Dim A's Avatar
    Join Date
    Jul 2000
    Posts
    201

    More like this...

    You might like this code block better. I think there's some issue with vbcr/vblinefeed/vbnewline so you might want to look into that.

    Code:
    Private Sub Text1_KeyPress(KeyAscii As Integer)
    Dim x As Long
    Dim y As Long
    Dim found As Boolean
    Dim LastLine As String
    
    If KeyAscii = vbKeyReturn Then
        x = Text1.SelStart
        y = x
        
        While y > 1 And found = False
            y = y - 1
            If Mid$(Text1.Text, y, 1) = vbCr Then
                found = True
            End If
        Wend
    
        If y = 0 Then y = 1
    
        LastLine = Mid$(Text1.Text, y, x - y + 1)
        Debug.Print LastLine
    End If
    End Sub
    Anyways... y is the position of the CR just before the last line, x is the position after the last CR, and of course LastLine is the last line of text.

    Hope this helps, I didn't get a chance to polish it up.

    - Dim A
    Last edited by Dim A; May 17th, 2001 at 03:59 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width