Silvester said:
I have a textbox linked to a table textfield of size 55. How can I
trim a line of text that a user enters that is greater than 55 chars
and truncate it to the last space char < 55.
I'm not convinced this is feasible. If the field in the table has its
size set to 55 characters, the user will not be able to enter more than
55 characters in the text box, no matter what. I suppose you could use
the text box's KeyPress event to detect that the user has continued to
type in it, even after the length of its Text property is 55, but it
seems a lot like guessing to me. What if the user types 55 characters,
then accidentally types an extra letter, sees that it doesn't appear,
and is then satisfied with the all 55 characters that are currently
displayed?
I suppose you might use an unbound text box, let the user type as many
characters as he wants, and then truncate it before assigning it to the
field itself; but then you're letting the user waste time typing
characters that won't be accepted, with no clue that this is a waste of
time. That's not good user-interface design, I think.