De-Highlight Unbound Text Box

D

dbarmer

I have an unbound text box that I use on a form that updates text to it as
code progresses in VBA. It updates the user what the program is doing. It
works well, however, I can't seem to get the "highlight" off the text. Is
there a way to get that insertion point at the end of the text - in the
unbound text box, or at least not highlight at all...
 
D

Dirk Goldgar

dbarmer said:
I have an unbound text box that I use on a form that updates text to it as
code progresses in VBA. It updates the user what the program is doing.
It
works well, however, I can't seem to get the "highlight" off the text. Is
there a way to get that insertion point at the end of the text - in the
unbound text box, or at least not highlight at all...


How are you updating this text box? What code are you using? If you are
setting the focus to the text box -- maybe to set its Text property -- you
almost certainly probably don't need to be doing it. You can set the
control's Value property without giving it the focus. If you really have to
give the text box the focus, you can set its SelLength property to 0
whenever you do that, to de-select the text. However, I have an alternative
suggestion:

If the text box is not to be updatable by the user, but is just used to
display text you put there, why not use a label control instead? You can
change its Caption property on the fly, just as easily as setting the value
of a text box, and a label control can't get the focus and never highlights
the caption text.
 
D

dbarmer

Thanks Douglas, That worked like a charm!.... Question: I update the
display text about 10 or so times. Instead of repeating that code over and
over, do you think it will work okay if I use a gosub for that procedure with
variables?

P.S. Since I open this form on top of another I had to change the "ME." to
FORMS!.... formname, textbox - But it worked fine once I did that!
 

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