How to put mouse coursor at left side

  • Thread starter Thread starter Marco
  • Start date Start date
M

Marco

How can I put the mouse coursor at the left side of a text box when I click
on the text box?

Thanks,
Marco
 
Marco said:
How can I put the mouse coursor at the left side of a text box when I
click
on the text box?


If you need to override the default behavior when clicking into a text box,
you can code the text box's Click event, like this:

Private Sub MyTextbox_Click()

Me!MyTextbox.SelStart = 0

End Sub
 
From:
http://www.eggheadcafe.com/software/aspnet/31815637/set-the-cursor-position.aspx

"
Set the cursor position - fredg
11-Mar-08 05:49:54

If the user clicks into the field, the cursor position will be where
ever the user has clicked.

If the user tab's into the field, you can position the cursor at the
beginning.
Code the control's Enter event:

Me.[ControlName].SelStart = 1

Or ...

to position it at the end of the existing data, you can use:

Me.[ControlName].SelStart = Len(Me.[ControlName])

--
Fred
"
How can I put the mouse coursor at the left side of a text box when I click
on the text box?

Thanks,
Marco

Just be aware, as stated in this reply, (>If the user tab's into the
field, <) the code will position the cursor at the beginning of the
field only when tabbed into or the control is selected using code.
If the user clicks in the field the cursor will be positioned wherever
the user has clicked.
 
BruceM said:
You may want to check for Null or zero-length first, so that a user can
click to edit.


Good point. It depends on how the text box is to be used.
 
Back
Top