VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Determine current line in a multi-line text box

by Anonymous (267 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Fri 22nd January 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Determine current line in a multi-line text box

API Declarations


Public Const EM_LINEFROMCHAR = &HC9

Rate Determine current line in a multi-line text box



Private Sub Text1_Change()
    'get the line the cursor is currently on
    Dim lngCurrentLine As Long
    On Local Error Resume Next
    lngCurrentLine = SendMessageLong(Text1.hwnd, EM_LINEFROMCHAR, -1&, 0&) + 1
    'for demonstration purposes, display line.
    'normally you will create a label and display this info in the label
    MsgBox Format$(lngCurrentLine, "##,###")
End Sub

Download this snippet    Add to My Saved Code

Determine current line in a multi-line text box Comments

No comments have been posted about Determine current line in a multi-line text box. Why not be the first to post a comment about Determine current line in a multi-line text box.

Post your comment

Subject:
Message:
0/1000 characters