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
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