Click to See Complete Forum and Search --> : Textbox Question
Smie
Jan 13th, 2000, 12:19 PM
is it possible to tell how many lines down on a multiline textbox, the text goes? Let me rephrase that if it was confusing, how can i tell how far the text goes down on a textbox? (eg. 3 lines)For example, i am typing this out, and the text has wrapped to make 7 lines. any help?
Joacim Andersson
Jan 13th, 2000, 02:56 PM
Sure, the following code show you how to count the number of lines in a textbox.
If you want more information please red my article, Extending the TextBox Control (http://www.vb-world.net/api/textboxex/index2.html) here at VB-World.
Public Declare Function SendMessage _
Lib "user32" Alias "SendMessageA" ( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Public Const EM_GETLINECOUNT = &HBA
Public Function LineCount(txtBox As TextBox) As Long
LineCount = SendMessage( _
TxtBox.hWnd, EM_GETLINECOUNT, 0&, 0&)
End Function
Good luck!
------------------
Joacim Andersson
joacim@programmer.net
joacim@yellowblazer.com
www.YellowBlazer.com (http://www.YellowBlazer.com)
Smie
Jan 13th, 2000, 08:25 PM
Thanks, how would I make it preform a certain task when it has reached, say line 15?
Inhumanoid
Jan 13th, 2000, 08:33 PM
If LineCount(text1) = 15 then
'do task
end if
Put this in the change event of the textbox or something
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.