by Prashant Sharma (4 Submissions)
Category: String Manipulation
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Mon 28th October 2002
Date Added: Mon 8th February 2021
Rating:
(1 Votes)
This snippet explaines the use of SendMessageA API of user32 library, to get number of lines in a textbox. The line count is obtained from the
API Declarations
'WebSite: http://www.prashantsharma.com
'EMail: [email protected]
'You can declare the API function and the constant value in the form itself
'as PRIVATE or in a module as PUBLIC
Private Declare Function SendMessageA Lib "user32" (ByVal hwnd As Long, _
ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const EM_GETLINECOUNT = &HBA
'the count as a return value for a function
Public Function LineCountInText1() As Long
Dim lCount As Long
lCount = SendMessageA(Text1.hWnd, EM_GETLINECOUNT, 0&, 0&) 'This is all we need to do, Result will be the count of lines
LineCountInText1 = lCount 'Use the count
End Function
No comments have been posted about This snippet explaines the use of SendMessageA API of user32 library, to get number of lines in a t. Why not be the first to post a comment about This snippet explaines the use of SendMessageA API of user32 library, to get number of lines in a t.