|
-
Sep 8th, 2000, 05:54 PM
#1
Thread Starter
Lively Member
How do you count the lines from a text box or a richtextbox... ?
-
Sep 8th, 2000, 06:07 PM
#2
Use the EM_GETLINECOUNT message.
Code:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const EM_GETLINECOUNT = &HBA
Private Sub Command1_Click()
Dim iLines As Integer
iLines = SendMessage(Text1.hwnd, EM_GETLINECOUNT, 0, 0)
MsgBox ("There are " & iLines & " lines in Text1")
End Sub
[Edited by Megatron on 09-08-2000 at 07:10 PM]
-
Sep 8th, 2000, 06:12 PM
#3
Thread Starter
Lively Member
wow... is that easy or what!!!
Good lord megatron... how do you know all these stuffs...
Anywayz thanks alot for the code
-
Sep 11th, 2000, 10:25 AM
#4
Member
Customization?
This returns the total line count only. What if I want to count only to the cursor? Is there a way to customize for that functionality?
-
Sep 12th, 2000, 10:00 AM
#5
Frenzied Member
Hope ya still need it! (or actaully I hope you allready have the answer but well...)
http://www.mvps.org/vbnet/code/texta...urrentline.htm
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Sep 12th, 2000, 10:35 AM
#6
Member
THANK YOU!!
That's it. Nope, I hadn't found an answer yet. Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|