|
-
Nov 12th, 2001, 03:41 PM
#1
Thread Starter
Fanatic Member
Text Box Line Count
Hey
How do I count how many lines there are in a RichTexBox
Thanks
-
Nov 12th, 2001, 03:43 PM
#2
VB Code:
Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const EM_GETLINECOUNT = &HBA
'To Get How Many Lines In Text Box, in the textbox change event, put
Dim lineCount As Long
On Local Error Resume Next
lineCount = SendMessageLong(RichTextBox1.hwnd, EM_GETLINECOUNT, 0&, 0&)
Label1 = Format$(lineCount, "##,###")
-
Nov 12th, 2001, 03:45 PM
#3
[code]
'VB only way
function linecount() as long
Dim a() as string
a = Split(rtb1.Text,vbcrlf)
linecount=ubound(a+1)
end function
-
Nov 12th, 2001, 03:49 PM
#4
Thread Starter
Fanatic Member
Thanks, now I can continue my chat room
-
Nov 12th, 2001, 03:52 PM
#5
PowerPoster
what about vbLf's Jim? That will only count Cr's
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
|