my task: to design a wordprocessing program for php code in VB. the only part i'm having trouble with is having a function that counts the lines in the text box. any ideas how i could do this?
Printable View
my task: to design a wordprocessing program for php code in VB. the only part i'm having trouble with is having a function that counts the lines in the text box. any ideas how i could do this?
Count the number of vbCrLf in the text box. Or better yet, split on vbCrLf and get the UBound of the array returned.
1) This isn't a PHP questionQuote:
Originally posted by blindlizard
Count the number of vbCrLf in the text box. Or better yet, split on vbCrLf and get the UBound of the array returned.
2) If there's a wordwrap feature, then counting vbCrLf's wont work
i think it would work with a wordwrap, because if one line goes onto the next, i dont theres a hard newline at the end
it doesnt matter if this isnt a php question, just answer it and tell them to post in the right forum next time :rolleyes:
1) No, it will not work with wordwrap. It will give you the number of actual lines, but not the number of visual lines.Quote:
Originally posted by nabeels786
i think it would work with a wordwrap, because if one line goes onto the next, i dont theres a hard newline at the end
it doesnt matter if this isnt a php question, just answer it and tell them to post in the right forum next time :rolleyes:
2) If it doesn't matter that it's not a PHP question, then why tell them to post in the right forum? :rolleyes:
Using API:
VB 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() MsgBox SendMessage(Text1.hwnd, EM_GETLINECOUNT, 0&, 0&) End Sub
Will retrieve the number of lines in the textbox, not dependant on vbCrLf's.
so then next time they will post them in the right forum instead of here..Quote:
[i]the number of actual lines, but not the number of visual lines.
2) If it doesn't matter that it's not a PHP question, then why tell them to post in the right forum? :rolleyes:
But you said it didn't matter, nablees :) I love you's like a brotha, man. Pe-yece!
when i posted this on the vb forum, ppl said "this isn't a vb problem, post elsewhere." so i just posted it in both.
thanx for all suggestions :D