Find the last edit position in Text Box

K

Kiran

I need to determine the last edited position in the Text Box. For instance if
I add, “in Greek†after emperor in the below sentence, the edit position
would be the space after Greek and not the end of sentence. How do I
determine this position in Textbox?
Once upon a time there lived an emperor called Alexander.
 
R

Rob Parker

Hi Kiran,

You can use the .SelStart property of the textbox, in the Change event of
the textbox, to determine the current position of the cursor while you are
editing the field. If you want to return to that position, you will need to
store it somewhere; an unbound textbox will retain the value while the form
is open, but you'll need either a global variable or (probably better) a
field in a table if you want to retain it for use when the form is
re-opened. You can then use the stored value to set the SelStart position
in the GotFocus event of the textbox; but that will only work if you tab to
the textbox; if you click in it, the SelStart position will be reset to
where you clicked.

HTH,

Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top