I've got no beef with using the API - I never commented on that at
all. But when a suggestion was posted that the API was the way to
go, without any clues as to how to actually do it . . .
You are a liar, James. I made the suggestion to use the API and I made it
within hours of the OP posting his original question, almost two days before
your own first post, and I DID give some clues on how to achieve it, so you
are lying when you say I did not. I specifically suggested that he should
use the SendMessage API (clue number one) to send an EM_GETLINECOUNT message
(clue number two) and follow that with the appropriate number of EM_GETLINE
messages (clue number three).
and OP indicated he was unfamiliar with the API, I suggested that
it was probably not worth the effort in learning to use the API, and
offered an alternative for which there was a complete, functioning
example.
Again, you are a liar James. The above statement of yours is okay until you
reach the word 'functioning', and that's when the lie begins. The code you
offered does not work. It happens to come up with the correct solution in a
few specific cases, but in many other cases it fails completely, as I have
amply demonstrated in other replies in this thread. It even fails
dramatically in the very specific circumstances in which you later said it
was at its most reliable! Code such as that, which works in such an
unreliable fashion and which sometimes by chance produces the correct
solution but which often does not, is in fact far worse than code which
simply never works at all. And yet you have called it a 'complete
functioning example' and you are continuing to do so, even after it has been
clearly shown that it does not work. That is a lie, James. Making incorrect
statements is not always a lie of course, sometimes it is just a mistake,
but in this case it has already been clearly demonstrated that the code you
offered does not work and yet you are refusing to accept that fact and you
are continuing to tell people, including the OP, that it does work. That is
an outright lie, James.
When a subsequent suggestion was made that the example
didn't work I pointed out what was probably wrong with
the testing setup.
There was nothing wrong with the testing setup! There was in fact something
wrong with the code! You really are sticking your head deeply into the sand
James. Why are you doing that? I told you that it was unreliable and that
although it might work with the specific textbox setting and text string
contained in the example it would fail to work with many other strings and
with many other textbox settings. You then suggested that people might like
to make all sorts of different modifications to the code in an attempt to
get it working, but you failed to make such modifications yourself and we
still have not seen from you an example of that code that actually works. As
it stands, the code simply does not work, and so I again suggested that the
OP might like to go with the method that I had originally suggested (the
SendMessage method) which /does/ work.
It seems there are some here more interested in arguing
amongst themselves than in providing solutions to the
problems being posed.
The only person to whom that statement clearly applies is YOURSELF! There
have been two solutions posted here which actually work, one an API
SendMessage solution posted by Tom Shelton and the other a VB.Net
GetFirstCharIndexFromLine function solution posted by myself. It is YOU who
have shown more interest in arguing than in posting solutions, and it is YOU
who have not yet posted a solution that works. Just give it up, James. Get
your head out of the sand.
Mike