Selection In A Textbox

M

Mark

How can I turn the selection highlight off when I enter a textbox? I tried
setting SelLength to 0 but it still selected 1 character. Can I change the color
of the selection highlight?

I want to turn the backcolor of a textbox to blue in the OnEnter event but the
selection highlight interferes with what I want to do.

Thanks!

Mark
 
U

UpRider

Mark, I think there are two problems.
1. Tools|Options|Keyboard|Behavior Entering Field take option "Go to
Start"
This will stop the whole field being selected.
2. As for the background color when entering/leaving a field, do this:
OnGotFocus enter "=fcnHiLite()"
OnLostFocus enter "=fcnLoLite()"
3. Put these functions in a module:
(this is aircode, but probably good)

Function fcnHiLite()
On Error Resume Next
Dim ctlCurr As Control
Set ctlCurr = Screen.ActiveControl
ctlCurr.BackColor = 7534830 'yellow
End Function
Function fcnLoLite()
On Error Resume Next
Dim ctlCurr As Control
Set ctlCurr = Screen.ActiveControl
ctlCurr.BackColor = 16777215 'white
End Function

You can adjust the colors by changing the numbers..

HTH, UpRider
 

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