OnClick property

G

Guest

When an enduser clicks in a field, I want the cursor to be at the beginning
of that field. I think I can use the OnClick Property but don't know the
code for it.
 
W

Wayne Morgan

To do this for all controls, go to Tools|Options|Keyboard tab and set the
desired setting under "Behavior entering field". To do this for just one
control, in the Click or Enter event of the control try something like:

Me.ActiveControl.SelStart = 0

If you do this in the Enter event, when you tab into the control it will do
what you want. If you click into the control, the cursor will go where
you've clicked. If you do it in the click event, the cursor will go where
you've clicked when the mouse button is down, but will jump to the start of
the field text when you release the mouse button. You may need to place the
code in both locations.
 

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