>The code below always returns the length of the first line of text in a
>textbox under Windows XP.
>
>Function GetLineLen(txt As TextBox, line As Long) As Long
> GetLineLen = SendMessage(txt.hwnd, EM_LINELENGTH, ByVal line, ByVal 0&)
>End Function
Untested code:
Function GetLineLen(txt As TextBox, line As Long) As Long
Dim lineindex As Long
lineindex = SendMessage(txt.hwnd, EM_LINEINDEX, ByVal line, ByVal 0&)
GetLineLen = SendMessage(txt.hwnd, EM_LINELENGTH, ByVal lineindex, ByVal 0&)
End Function

Signature
--------- Scott Seligman <scott at <firstname> and michelle dot net> ---------
Bodily exercise, when compulsory, does no harm to the body; but
knowledge which is acquired under compulsion obtains no hold on the
mind. -- The Republic by Plato
Ed - 07 Jan 2008 20:44 GMT
>Untested code:
>
[quoted text clipped - 3 lines]
> GetLineLen = SendMessage(txt.hwnd, EM_LINELENGTH, ByVal lineindex, ByVal 0&)
>End Function
Did quick test and seems to be working fine!
Thanks,
Ed
> The code below always returns the length of the first line of text in a
> textbox under Windows XP.
[quoted text clipped - 4 lines]
>
> What should I be using for Windows XP?
Good thing Scott understood what you meant. <g>

Signature
Mike
Microsoft MVP Visual Basic
Ed - 09 Jan 2008 19:16 GMT
>Good thing Scott understood what you meant. <g>
I thought the subject made it pretty clear? ;)
MikeD - 10 Jan 2008 02:29 GMT
>>Good thing Scott understood what you meant. <g>
>
> I thought the subject made it pretty clear? ;)
Yes, it was clear he wanted the line length, but take another look at what
he wrote:
> The code below always returns the length of the first line of text in a
> textbox under Windows XP.
>
> What should I be using for Windows XP?
I guess I found the 2 references to Windows XP to be confusing. Possibly
just me.

Signature
Mike
Microsoft MVP Visual Basic